mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Bump CMake files to at least c++11.
Removed all configurations that explicitly test or set the c++ standard flags. The only place the standard is now configured is at the top of the main `CMakeLists.txt` file, which can easily be updated (e.g. if we decide to move to c++14+). This can also be set via command-line using ``` > cmake -DCMAKE_CXX_STANDARD 14 ``` Kept the `EIGEN_TEST_CXX11` flag for now - that still controls whether to build/run the `cxx11_*` tests. We will likely end up renaming these tests and removing the `CXX11` subfolder.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
dc5b1f7d75
commit
eeacbd26c8
@@ -10,9 +10,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# some examples and snippets needs c++11, so let's check it once
|
||||
check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)
|
||||
|
||||
option(EIGEN_INTERNAL_DOCUMENTATION "Build internal documentation" OFF)
|
||||
option(EIGEN_DOC_USE_MATHJAX "Use MathJax for rendering math in HTML docs" ON)
|
||||
|
||||
|
||||
@@ -14,7 +14,3 @@ foreach(example_src ${examples_SRCS})
|
||||
)
|
||||
add_dependencies(all_examples ${example})
|
||||
endforeach()
|
||||
|
||||
if(EIGEN_COMPILER_SUPPORT_CPP11)
|
||||
ei_add_target_property(nullary_indexing COMPILE_FLAGS "-std=c++11")
|
||||
endif()
|
||||
@@ -6,31 +6,26 @@ foreach(snippet_src ${snippets_SRCS})
|
||||
get_filename_component(snippet ${snippet_src} NAME_WE)
|
||||
set(compile_snippet_target compile_${snippet})
|
||||
set(compile_snippet_src ${compile_snippet_target}.cpp)
|
||||
if((NOT ${snippet_src} MATCHES "cxx11") OR EIGEN_COMPILER_SUPPORT_CPP11)
|
||||
file(READ ${snippet_src} snippet_source_code)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
add_executable(${compile_snippet_target}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
endif()
|
||||
if(${snippet_src} MATCHES "cxx11")
|
||||
set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
endif()
|
||||
if(${snippet_src} MATCHES "deprecated")
|
||||
set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-DEIGEN_NO_DEPRECATED_WARNING")
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET ${compile_snippet_target}
|
||||
POST_BUILD
|
||||
COMMAND ${compile_snippet_target}
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
|
||||
)
|
||||
add_dependencies(all_snippets ${compile_snippet_target})
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
|
||||
PROPERTIES OBJECT_DEPENDS ${snippet_src})
|
||||
else()
|
||||
message("skip snippet ${snippet_src} because compiler does not support C++11")
|
||||
|
||||
file(READ ${snippet_src} snippet_source_code)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
add_executable(${compile_snippet_target}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
endif()
|
||||
|
||||
if(${snippet_src} MATCHES "deprecated")
|
||||
set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-DEIGEN_NO_DEPRECATED_WARNING")
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET ${compile_snippet_target}
|
||||
POST_BUILD
|
||||
COMMAND ${compile_snippet_target}
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
|
||||
)
|
||||
add_dependencies(all_snippets ${compile_snippet_target})
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
|
||||
PROPERTIES OBJECT_DEPENDS ${snippet_src})
|
||||
endforeach()
|
||||
|
||||
@@ -19,16 +19,13 @@ if(QT4_FOUND)
|
||||
add_dependencies(all_examples Tutorial_sparse_example)
|
||||
endif()
|
||||
|
||||
if(EIGEN_COMPILER_SUPPORT_CPP11)
|
||||
add_executable(random_cpp11 random_cpp11.cpp)
|
||||
target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
add_dependencies(all_examples random_cpp11)
|
||||
ei_add_target_property(random_cpp11 COMPILE_FLAGS "-std=c++11")
|
||||
add_executable(random_cpp11 random_cpp11.cpp)
|
||||
target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
add_dependencies(all_examples random_cpp11)
|
||||
|
||||
add_custom_command(
|
||||
TARGET random_cpp11
|
||||
POST_BUILD
|
||||
COMMAND random_cpp11
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/random_cpp11.out
|
||||
)
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET random_cpp11
|
||||
POST_BUILD
|
||||
COMMAND random_cpp11
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/random_cpp11.out
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user