diff --git a/CMakeLists.txt b/CMakeLists.txt index 0137ebbb5aa091713979c1fa7fd86be27d982323..423366c39f848dab069b0a7cb056aa6c7c7d85b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ 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" ON) +option(PACKAGE_SYSTEM_LIBRARIES "Include system libraries in the package archive" OFF) # Finally decide whether to build static or shared libraries option(BUILD_SHARED_LIBS "Build shared libraries" OFF) @@ -50,6 +50,20 @@ else() message(STATUS "[${PROJECT_NAME}] -> Building static libraries") 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() + # Get Python and pipenv to build the Python packages set(PYTHON_TARGETS "") # List containing the python targets @@ -76,8 +90,8 @@ set(PYBIND11_FINDPYTHON ON) # Let pybind11 find the python interpreter add_subdirectory(extern/pybind11) # Set the output directory for all libraries -> Use generator expressions to force multi-generator output to the same location -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/unicadoRuntimeLibs$<0:>) # .dll for Windows -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/unicadoRuntimeLibs$<0:>) # .so for Unix +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/unicadoRuntimeLibs$<0:>) # .dll for Windows and .so for Unix +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/unicadoRuntimeLibs$<0:>) # .lib for Windows and .so for Unix # Include the library directories based on dependency order add_subdirectory(aerodynamics)