Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CMakeLists.txt 2.01 KiB
# CMakeList.txt: CMake-Projektdatei der obersten Ebene. Führen Sie eine globale Konfiguration durch,
# und schließen Sie hier Unterprojekte ein.
#
cmake_minimum_required (VERSION 3.20)

project ("app4mc.sim")
# CMAKE_PREFIX_PATH
SET(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install CACHE PATH "install default path set to <cmakeroot>/install" FORCE)
message("CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )

# leave redundant settings below in place (visual studio seems to default to c++ 11 if statements below are missing)
set (CMAKE_CXX_STANDARD 17 CACHE STRING
     "C++ standard to build all targets.")
set (CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL
     "The with CMAKE_CXX_STANDARD selected C++ standard is a requirement.")
mark_as_advanced (CMAKE_CXX_STANDARD_REQUIRED)

set (USE_APP4MCSIM_PCH TRUE CACHE BOOL "Use Precompiled Headers for APP4MC.sim compilation (typically this is a huge compilation speed up)")

include("cmake/utils.cmake")
include("cmake/unity_build.cmake")
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# we want to use CTest for Testing, but unfortunately, the SystemC library unconditionally include tests
# using the pattern of https://stackoverflow.com/a/63641367/6073286 to remove tests
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR} @ONLY)
    include(CTest)
endif()

# always use static linking for systemc lib
# currently there is no big advantage (in size) for dynamic linking, and 
# static linking allows more optimiziation + easier distribution
set (BUILD_SHARED_LIBS FALSE CACHE STRING "Build with dynamic linking of libraries")
add_subdirectory("systemc-lib" EXCLUDE_FROM_ALL)
set_target_properties(systemc PROPERTIES UNITY_BUILD OFF)
add_subdirectory("libs" EXCLUDE_FROM_ALL)

set_property(TARGET easyloggingpp PROPERTY CXX_STANDARD 17)


#Schließen Sie Unterprojekte ein.
add_subdirectory ("app4mc.sim_lib" EXCLUDE_FROM_ALL)

# build examples only, if APP4MC.sim is top project
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory ("examples")
endif ()