diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d36362ebb..b1c72b76a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -211,10 +211,10 @@ foreach(target ${test_targets}) # Always write the output file directly into the 'tests' directory (even on MSVC) if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${testdir}) + set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${testdir}") foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config} config) - set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} ${testdir}) + set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} "${testdir}") endforeach() endif() endforeach() diff --git a/tests/test_embed/CMakeLists.txt b/tests/test_embed/CMakeLists.txt index 8b4f1f843..c5aa7c6c5 100644 --- a/tests/test_embed/CMakeLists.txt +++ b/tests/test_embed/CMakeLists.txt @@ -17,25 +17,29 @@ add_executable(test_embed catch.cpp test_interpreter.cpp ) -target_include_directories(test_embed PRIVATE ${CATCH_INCLUDE_DIR}) +target_include_directories(test_embed PRIVATE "${CATCH_INCLUDE_DIR}") pybind11_enable_warnings(test_embed) if(NOT CMAKE_VERSION VERSION_LESS 3.0) target_link_libraries(test_embed PRIVATE pybind11::embed) else() - target_include_directories(test_embed PRIVATE ${PYBIND11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS}) - target_compile_options(test_embed PRIVATE ${PYBIND11_CPP_STANDARD}) - target_link_libraries(test_embed PRIVATE ${PYTHON_LIBRARIES}) + target_include_directories(test_embed PRIVATE "${PYBIND11_INCLUDE_DIR}" "${PYTHON_INCLUDE_DIRS}") + target_compile_options(test_embed PRIVATE "${PYBIND11_CPP_STANDARD}") + target_link_libraries(test_embed PRIVATE "${PYTHON_LIBRARIES}") endif() find_package(Threads REQUIRED) target_link_libraries(test_embed PUBLIC ${CMAKE_THREAD_LIBS_INIT}) add_custom_target(cpptest COMMAND $ - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") pybind11_add_module(external_module THIN_LTO external_module.cpp) -set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") +foreach(config ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${config} config) + set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} "${CMAKE_CURRENT_SOURCE_DIR}") +endforeach() add_dependencies(cpptest external_module) add_dependencies(check cpptest)