Commit 89120709 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

CMakeLists corrected

parent 54bff534
...@@ -63,6 +63,8 @@ test_compile_features(ENABLE_CXX11 amdis_base INTERFACE ...@@ -63,6 +63,8 @@ test_compile_features(ENABLE_CXX11 amdis_base INTERFACE
cxx_static_assert cxx_static_assert
cxx_variadic_templates) cxx_variadic_templates)
if (ENABLE_CXX11) if (ENABLE_CXX11)
# set(CMAKE_CXX_STANDARD 11)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
target_compile_definitions(amdis_base INTERFACE HAS_CXX11=1) target_compile_definitions(amdis_base INTERFACE HAS_CXX11=1)
else () else ()
target_compile_definitions(amdis_base INTERFACE HAS_CXX11=0) target_compile_definitions(amdis_base INTERFACE HAS_CXX11=0)
......
...@@ -16,6 +16,8 @@ test_compile_features(MTL_ENABLE_CXX11 mtl4 INTERFACE ...@@ -16,6 +16,8 @@ test_compile_features(MTL_ENABLE_CXX11 mtl4 INTERFACE
cxx_defaulted_functions) cxx_defaulted_functions)
if (MTL_ENABLE_CXX11) if (MTL_ENABLE_CXX11)
# set(CMAKE_CXX_STANDARD 11)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL") set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
foreach (feature ${CXX_ELEVEN_FEATURE_LIST}) foreach (feature ${CXX_ELEVEN_FEATURE_LIST})
target_compile_definitions(mtl4 INTERFACE MTL_WITH_${feature}) target_compile_definitions(mtl4 INTERFACE MTL_WITH_${feature})
......
function(test_compile_features RESULT_VAR TARGET SCOPE) # feature1 feature2 feature3 ...) macro(test_compile_features RESULT_VAR TARGET SCOPE) # feature1 feature2 feature3 ...)
set(_FEATURES "") set(_FEATURES "")
foreach(FEATURE ${ARGN}) foreach(FEATURE ${ARGN})
set(_FEATURES "${_FEATURES} ${FEATURE}") set(_FEATURES "${_FEATURES} ${FEATURE}")
endforeach() endforeach()
set(_DIR ${CMAKE_BINARY_DIR}/test_cxx11)
# test only of variable RESULT_VAR not yet set manually or by a # test only of variable RESULT_VAR not yet set manually or by a
# previous call to this macro # previous call to this macro
if (DEFINED ${RESULT_VAR}) if (NOT DEFINED ${RESULT_VAR})
return ()
endif ()
set(_DIR ${CMAKE_BINARY_DIR}/test_cxx11)
message(STATUS "Test for cxx11 features for target ${TARGET}") message(STATUS "Test for cxx11 features for target ${TARGET}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_DIR})
file(WRITE ${_DIR}/CMakeLists.txt " file(WRITE ${_DIR}/CMakeLists.txt "
...@@ -23,11 +19,16 @@ function(test_compile_features RESULT_VAR TARGET SCOPE) # feature1 feature2 feat ...@@ -23,11 +19,16 @@ function(test_compile_features RESULT_VAR TARGET SCOPE) # feature1 feature2 feat
execute_process(COMMAND ${CMAKE_COMMAND} ${_DIR} execute_process(COMMAND ${CMAKE_COMMAND} ${_DIR}
WORKING_DIRECTORY ${_DIR} WORKING_DIRECTORY ${_DIR}
RESULT_VARIABLE _RES_VAR OUTPUT_QUIET) RESULT_VARIABLE _ERR_CODE OUTPUT_QUIET)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${_DIR})
elseif (${RESULT_VAR})
set(_ERR_CODE "0")
else ()
set(_ERR_CODE "1")
endif ()
if ("${_RES_VAR}" STREQUAL "0") if ("${_ERR_CODE}" STREQUAL "0")
set(${RESULT_VAR} true CACHE BOOL "Enable C++11 compiler features") set(${RESULT_VAR} true CACHE BOOL "Enable C++11 compiler features")
target_compile_features(${TARGET} ${SCOPE} ${ARGN}) target_compile_features(${TARGET} ${SCOPE} ${ARGN})
else () else ()
...@@ -35,7 +36,7 @@ function(test_compile_features RESULT_VAR TARGET SCOPE) # feature1 feature2 feat ...@@ -35,7 +36,7 @@ function(test_compile_features RESULT_VAR TARGET SCOPE) # feature1 feature2 feat
endif () endif ()
mark_as_advanced(${RESULT_VAR}) mark_as_advanced(${RESULT_VAR})
#unset(_RES_VAR) unset(_ERR_CODE)
#unset(_DIR) unset(_DIR)
#unset(_FEATURES) unset(_FEATURES)
endfunction(test_compile_features) endmacro(test_compile_features)
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment