fix(cmake): configuration generation fails when BUILD_TESTS is OFF (#3416)

This commit is contained in:
MeeSong
2024-11-27 08:05:51 +08:00
committed by GitHub
parent d5854ae224
commit 8d2e322e1a

View File

@ -113,9 +113,15 @@ set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/src/ViG
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE) string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if("${BUILD_TYPE}" STREQUAL "XDEBUG") if("${BUILD_TYPE}" STREQUAL "XDEBUG")
if(WIN32) if(WIN32)
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp" if (NOT BUILD_TESTS)
DIRECTORY "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests" set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp"
PROPERTIES COMPILE_FLAGS -O2) DIRECTORY "${CMAKE_SOURCE_DIR}"
PROPERTIES COMPILE_FLAGS -O2)
else()
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp"
DIRECTORY "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests"
PROPERTIES COMPILE_FLAGS -O2)
endif()
endif() endif()
else() else()
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)