From b131a72dca6c6c8d9dd6ab1fc82e3d81b8b74836 Mon Sep 17 00:00:00 2001 From: program-- Date: Wed, 22 Nov 2023 08:24:05 -0800 Subject: [PATCH 1/2] cmake: configure NGenConfig.h into build directory and add interface target --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99c3ead45e..2924c25594 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,12 @@ endif() # ----------------------------------------------------------------------------- # Project Targets # ----------------------------------------------------------------------------- + +# Contains NGenConfig.h +add_library(ngen_config_header INTERFACE) +add_library(NGen::config_header ALIAS ngen_config_header) +target_include_directories(ngen_config_header INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/include") + target_include_directories(ngen PUBLIC "${NGEN_INC_DIR}") add_subdirectory("src/core") @@ -200,6 +206,7 @@ add_subdirectory("src/utilities/logging") target_link_libraries(ngen PUBLIC + NGen::config_header NGen::core NGen::core_catchment NGen::core_nexus @@ -347,4 +354,4 @@ ngen_dependent_multiline_message(NGEN_WITH_PYTHON " pybind11 Include: ${pybind11_INCLUDE_DIR}") message(STATUS "---------------------------------------------------------------------") -configure_file("${NGEN_INC_DIR}/NGenConfig.h.in" "${NGEN_INC_DIR}/NGenConfig.h") +configure_file("${NGEN_INC_DIR}/NGenConfig.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/NGenConfig.h") From 5c0bd8ee24a6c0012312681ec21fa3e2ad15a968 Mon Sep 17 00:00:00 2001 From: program-- Date: Mon, 27 Nov 2023 10:59:14 -0800 Subject: [PATCH 2/2] core: configure python build version per build dir --- src/core/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 14f4b23d11..8679eb3af2 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -35,8 +35,11 @@ if (NGEN_WITH_PYTHON) ${PROJECT_SOURCE_DIR}/include/utilities ${PROJECT_SOURCE_DIR}/extern/pybind11/include ) - configure_file(${PROJECT_SOURCE_DIR}/src/core/NGen_Python_Build_Versions.in NGen_Python_Build_Versions.cpp) - target_sources(core PRIVATE NGen_Python_Build_Versions.cpp) + configure_file( + ${PROJECT_SOURCE_DIR}/src/core/NGen_Python_Build_Versions.in + ${CMAKE_CURRENT_BINARY_DIR}/src/core/NGen_Python_Build_Versions.cpp + ) + target_sources(core PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/core/NGen_Python_Build_Versions.cpp) target_link_libraries(core PUBLIC Boost::boost # Headers-only Boost pybind11::embed