From 1be954ff70eb3ebb48d3937c53187d8c869659b5 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 26 Dec 2022 22:44:13 -0600 Subject: [PATCH] Keep generated headers within project binary directory This stops them from appearing in the build directories of projects that may consume Catch2. --- src/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b54c6274..cd83a0b4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,7 @@ set(BENCHMARK_FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) set(IMPL_HEADERS - "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" + "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" ${SOURCES_DIR}/catch_user_config.hpp.in ${SOURCES_DIR}/catch_all.hpp ${SOURCES_DIR}/catch_approx.hpp @@ -321,7 +321,7 @@ set(ALL_FILES ) set(FILTERED_FILES ${ALL_FILES}) -list(REMOVE_ITEM FILTERED_FILES "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp") +list(REMOVE_ITEM FILTERED_FILES "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp") source_group( TREE ${SOURCES_DIR} PREFIX sources @@ -329,7 +329,7 @@ source_group( ) source_group("generated headers" FILES - "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" + "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" ) add_library(Catch2 ${ALL_FILES}) @@ -372,13 +372,13 @@ target_compile_features(Catch2 configure_file( "${SOURCES_DIR}/catch_user_config.hpp.in" - "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" + "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" ) target_include_directories(Catch2 PUBLIC $ - $ + $ $ ) @@ -426,7 +426,7 @@ if (NOT_SUBPROJECT) install( DIRECTORY "${SOURCES_DIR}" - "${CMAKE_BINARY_DIR}/generated-includes/catch2" # Also install the generated header + "${PROJECT_BINARY_DIR}/generated-includes/catch2" # Also install the generated header DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING @@ -447,7 +447,7 @@ if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS) target_include_directories(Catch2_buildall_interface INTERFACE $ - $ + $ $ ) target_compile_definitions(Catch2_buildall_interface