diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aae44ba7f5b0392d498fa84e7ca5337816dbd0e..ff96d6d1612d8ac2ae367bf838f6960f46385c02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ endif() option(BUILD_BLACKBOXTESTS "Use blackbox testing" OFF) # Option for unit testing option(BUILD_UNITTEST "Use unit testing" OFF) +# Option to include system libraries in the package archive +option(PACKAGE_SYSTEM_LIBRARIES "Include system libraries in the package archive" OFF) # Option where to look for the libraries option(FIND_LIBRARIES_AS_PACKAGE "If true the libraries are included with find_package(), otherwise the submodule is used." OFF) # Option to compile Python modules to an executable @@ -74,6 +76,20 @@ else() add_subdirectory(libs) endif() +if(PACKAGE_SYSTEM_LIBRARIES) + if(BUILD_SHARED_LIBS) + get_filename_component( SYSTEM_LIBS_PATH ${CMAKE_CXX_COMPILER} PATH ) + message(STATUS "[${PROJECT_NAME}] -> Packaging System Libraries from: ${SYSTEM_LIBS_PATH}") + message(DEPRECATION "Packaging system libraries is enabled. This will be removed in the future due to the native compiler support!") + else() # Activate static linkage of compiler runtime libs + if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT") + else(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") + endif() + endif() +endif() + # === External dependencies === include(FetchContent)