Newer
Older
project (
corsika
VERSION 8.0.0
DESCRIPTION "CORSIKA C++ project"
LANGUAGES CXX
)
# ignore many irrelevant Up-to-date messages during install
# directory for local cmake modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
include (CorsikaUtilities) # a few cmake function
Maximilian Reininghaus
committed
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_EXTENSIONS OFF)
option(COVERAGE "Generate coverage data" OFF)
if(COVERAGE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
# Set a default build type if none was specified
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as no other was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g") # -O2 would not trade speed for size, neither O2/3 use fast-math
set(CMAKE_Fortran_FLAGS "-std=legacy")
if(COVERAGE)
set(CMAKE_CXX_FLAGS "--coverage")
set(CMAKE_EXE_LINKER_FLAGS "--coverage")
set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
endif()
# clang produces a lot of unecessary warnings without this:
add_compile_options("$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-nonportable-include-path>")
# COAST - interface
if (WITH_COAST)
message(STATUS "Compiling CORSIKA8 for the use with COAST/corsika7.")
add_compile_options("-fPIC")
endif()
#add_custom_target (corsika_pre_build)
#add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
find_package (Pythia8) # optional
find_package (Eigen3 REQUIRED)
#find_package (HDF5) # not yet needed
ralfulrich
committed
#add_subdirectory (Utilities)
add_subdirectory (Environment)
ralfulrich
committed
add_subdirectory (Setup)
ralfulrich
committed
add_subdirectory (Processes)
add_subdirectory (Documentation)
if (WITH_COAST)
add_subdirectory (COAST)
endif()