cmake variable NG_COMPILE_FLAGS to set additional compile options

This commit is contained in:
Matthias Hochsteger 2020-10-01 13:35:53 +02:00
parent 5e1aaddd14
commit 7a1344bfcb
3 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,8 @@ option( BUILD_FOR_CONDA "Link python libraries only to executables" OFF)
option( USE_SUPERBUILD "use ccache" ON)
set(NG_COMPILE_FLAGS "" CACHE STRING "Additional compile flags")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules")
if(APPLE)

View File

@ -145,6 +145,7 @@ set_vars( NETGEN_CMAKE_ARGS
CHECK_RANGE
BUILD_STUB_FILES
BUILD_FOR_CONDA
NG_COMPILE_FLAGS
)
# propagate all variables set on the command line using cmake -DFOO=BAR

View File

@ -14,6 +14,8 @@ add_library(ngcore SHARED
version.cpp
)
target_compile_options(ngcore PUBLIC "${NG_COMPILE_FLAGS}")
# Pybind11 2.3 Issue https://github.com/pybind/pybind11/issues/1604
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_compile_options(ngcore PUBLIC -fsized-deallocation -faligned-allocation)