From 8d2e322e1ac46345b5fbd443796134a0717c79a2 Mon Sep 17 00:00:00 2001 From: MeeSong <50670906+MiroKaku@users.noreply.github.com> Date: Wed, 27 Nov 2024 08:05:51 +0800 Subject: [PATCH] fix(cmake): configuration generation fails when BUILD_TESTS is OFF (#3416) --- cmake/targets/common.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/targets/common.cmake b/cmake/targets/common.cmake index e928b2c5..4cff2ce6 100644 --- a/cmake/targets/common.cmake +++ b/cmake/targets/common.cmake @@ -113,9 +113,15 @@ set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/src/ViG string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE) if("${BUILD_TYPE}" STREQUAL "XDEBUG") if(WIN32) - set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp" - DIRECTORY "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests" - PROPERTIES COMPILE_FLAGS -O2) + if (NOT BUILD_TESTS) + set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp" + 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() else() add_definitions(-DNDEBUG)