Back to home page

EIC code displayed by LXR

 
 

    


Warning, /acts/cmake/ActsCompilerOptions.cmake is written in an unsupported language. File is not indexed.

0001 # Acts compiler flags
0002 if(NOT CMAKE_BUILD_TYPE)
0003     set(CMAKE_BUILD_TYPE
0004         RelWithDebInfo
0005         CACHE STRING
0006         "Build type configuration"
0007         FORCE
0008     )
0009     message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
0010 endif()
0011 
0012 set(cxx_flags
0013     "-Wall -Wextra -Wpedantic -Wshadow -Wzero-as-null-pointer-constant -Wold-style-cast"
0014 )
0015 
0016 # Add assertions to standard libraries
0017 if(ACTS_FORCE_ASSERTIONS)
0018     set(cxx_flags "${cxx_flags} -D_GLIBCXX_ASSERTIONS -D_LIBCPP_DEBUG")
0019 endif()
0020 
0021 # This adds some useful conversion checks like float-to-bool, float-to-int, etc.
0022 # However, at the moment this is only added to clang builds, since GCC's -Wfloat-conversion
0023 # is much more aggressive and also triggers on e.g., double-to-float
0024 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
0025     set(cxx_flags "${cxx_flags} -Wfloat-conversion")
0026 endif()
0027 
0028 # -Wnull-dereference gets applied to -isystem includes in GCC13,
0029 # which causes lots of warnings in code we have no control over
0030 if(
0031     CMAKE_CXX_COMPILER_ID MATCHES "Clang"
0032     OR (
0033         CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
0034         AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 12
0035     )
0036 )
0037     set(cxx_flags "${cxx_flags} -Wnull-dereference")
0038 endif()
0039 
0040 set(ACTS_CXX_STANDARD 20)
0041 set(ACTS_CXX_STANDARD_FEATURE cxx_std_20)
0042 if(DEFINED CMAKE_CXX_STANDARD)
0043     if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20)
0044         set(ACTS_CXX_STANDARD ${CMAKE_CXX_STANDARD})
0045         set(ACTS_CXX_STANDARD_FEATURE "cxx_std_${CMAKE_CXX_STANDARD}")
0046     else()
0047         message(
0048             SEND_ERROR
0049             "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}, but ACTS requires C++ >=20"
0050         )
0051     endif()
0052 endif()
0053 
0054 if(ACTS_ENABLE_CPU_PROFILING OR ACTS_ENABLE_MEMORY_PROFILING)
0055     message(STATUS "Added debug symbol compile flag")
0056     set(cxx_flags "${cxx_flags} ${CMAKE_CXX_FLAGS_DEBUG_INIT}")
0057 endif()
0058 
0059 # assign to global CXX flags
0060 set(CMAKE_CXX_FLAGS "${cxx_flags} ${CMAKE_CXX_FLAGS}")
0061 message(STATUS "Using compiler flags: ${CMAKE_CXX_FLAGS}")
0062 
0063 # silence warning about missing RPATH on Mac OSX
0064 set(CMAKE_MACOSX_RPATH 1)
0065 
0066 # bake where we found external dependencies, if they were not in the default library directories
0067 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
0068 # set relative library path for ACTS libraries
0069 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")