From c8cb5baa079743d4a40e4ee29952ccc4768f1a0c Mon Sep 17 00:00:00 2001 From: Luis Venancio Date: Mon, 26 Aug 2024 17:32:58 +0100 Subject: [PATCH] cmake: Now possible to add core files to private. --- CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cb88b284f..5d99fcd527 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,6 +168,10 @@ file(GLOB_RECURSE DUNE_CORE_HEADERS "${PROJECT_SOURCE_DIR}/src/DUNE/*.hpp" file(GLOB_RECURSE DUNE_CORE_DEFS "${PROJECT_SOURCE_DIR}/src/DUNE/*.def") string(REPLACE ";" " " DUNE_CORE_HEADERS_STRING "${DUNE_CORE_HEADERS}") +file(GLOB_RECURSE PRIVATE_CORE_SOURCES "${PROJECT_SOURCE_DIR}/private*/src/DUNE/Control/*.cpp") +file(GLOB_RECURSE PRIVATE_CORE_HEADERS "${PROJECT_SOURCE_DIR}/private*/src/DUNE/Control/*.hpp") +string(REPLACE ";" " " PRIVATE_CORE_HEADERS_STRING "${PRIVATE_CORE_HEADERS}") + file(GLOB_RECURSE USER_CORE_SOURCES "${PROJECT_SOURCE_DIR}/user*/src/USER/*.cpp") file(GLOB_RECURSE USER_CORE_HEADERS "${PROJECT_SOURCE_DIR}/user*/src/USER/*.hpp") string(REPLACE ";" " " USER_CORE_HEADERS_STRING "${USER_CORE_HEADERS}") @@ -180,7 +184,7 @@ install(FILES ${DUNE_GENERATED}/src/DUNE/Config.hpp include(${PROJECT_SOURCE_DIR}/cmake/Version.cmake) -set_source_files_properties(${DUNE_CORE_SOURCES} ${USER_CORE_SOURCES} +set_source_files_properties(${DUNE_CORE_SOURCES} ${USER_CORE_SOURCES} ${PRIVATE_CORE_SOURCES} PROPERTIES COMPILE_FLAGS "${DUNE_CXX_FLAGS} ${DUNE_CXX_FLAGS_STRICT}") if(DUNE_OS_WINDOWS) @@ -191,7 +195,7 @@ if(DUNE_OS_WINDOWS) ${DUNE_GENERATED}/src/DUNE/Version.rc) endif(DUNE_OS_WINDOWS) -foreach(header ${DUNE_CORE_HEADERS} ${USER_CORE_HEADERS}) +foreach(header ${DUNE_CORE_HEADERS} ${USER_CORE_HEADERS} ${PRIVATE_CORE_HEADERS}) string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/" "" header ${header}) string(REGEX REPLACE "src" "include" destination ${header}) get_filename_component(destination ${destination} PATH) @@ -217,19 +221,21 @@ foreach(extlib ${extlibs}) endforeach(extlib ${extlibs}) file(GLOB DUNE_SOURCE_USER ${PROJECT_SOURCE_DIR}/user*/src) -include_directories(${DUNE_GENERATED}/src ${PROJECT_SOURCE_DIR}/src ${DUNE_SOURCE_USER} ${DUNE_VENDOR_INCS_DIR}) +file(GLOB DUNE_SOURCE_PRIVATE ${PROJECT_SOURCE_DIR}/private*/src) +include_directories(${DUNE_GENERATED}/src ${PROJECT_SOURCE_DIR}/src ${DUNE_SOURCE_USER} ${DUNE_SOURCE_PRIVATE} ${DUNE_VENDOR_INCS_DIR}) link_directories(${DUNE_VENDOR_LIBS_DIR}) set(DUNE_CORE_FILES ${DUNE_CORE_SOURCES} ${DUNE_VENDOR_FILES}) set(USER_CORE_FILES ${USER_CORE_SOURCES} ${USER_VENDOR_FILES}) +set(PRIVATE_CORE_FILES ${PRIVATE_CORE_SOURCES} ${PRIVATE_VENDOR_FILES}) if(DUNE_SHARED) message(STATUS "Building shared library") - add_library(dune-core SHARED ${DUNE_CORE_FILES} ${USER_CORE_FILES} ) + add_library(dune-core SHARED ${DUNE_CORE_FILES} ${USER_CORE_FILES} ${PRIVATE_CORE_FILES} ) set_target_properties(dune-core PROPERTIES DEFINE_SYMBOL DUNE_DLL_EXPORT) target_link_libraries(dune-core ${DUNE_SYS_LIBS}) else(DUNE_SHARED) message(STATUS "Building static library") - add_library(dune-core STATIC ${DUNE_CORE_FILES} ${USER_CORE_FILES} ) + add_library(dune-core STATIC ${DUNE_CORE_FILES} ${USER_CORE_FILES} ${PRIVATE_CORE_FILES} ) if(DUNE_CXX_MICROSOFT AND DUNE_CPU_X86) if(DUNE_CPU_32B) set_target_properties(dune-core PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x86")