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") 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