mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Add support for c++11 snippets
This commit is contained in:
parent
3e64b1fc86
commit
91613bf2c2
@ -6,6 +6,7 @@ foreach(snippet_src ${snippets_SRCS})
|
|||||||
get_filename_component(snippet ${snippet_src} NAME_WE)
|
get_filename_component(snippet ${snippet_src} NAME_WE)
|
||||||
set(compile_snippet_target compile_${snippet})
|
set(compile_snippet_target compile_${snippet})
|
||||||
set(compile_snippet_src ${compile_snippet_target}.cpp)
|
set(compile_snippet_src ${compile_snippet_target}.cpp)
|
||||||
|
if((NOT ${snippet_src} MATCHES "cxx11") OR EIGEN_COMPILER_SUPPORT_CXX11)
|
||||||
file(READ ${snippet_src} snippet_source_code)
|
file(READ ${snippet_src} snippet_source_code)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||||
@ -14,6 +15,9 @@ foreach(snippet_src ${snippets_SRCS})
|
|||||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||||
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||||
endif()
|
endif()
|
||||||
|
if(${snippet_src} MATCHES "cxx11")
|
||||||
|
set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||||
|
endif()
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${compile_snippet_target}
|
TARGET ${compile_snippet_target}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
@ -23,4 +27,7 @@ foreach(snippet_src ${snippets_SRCS})
|
|||||||
add_dependencies(all_snippets ${compile_snippet_target})
|
add_dependencies(all_snippets ${compile_snippet_target})
|
||||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
|
||||||
PROPERTIES OBJECT_DEPENDS ${snippet_src})
|
PROPERTIES OBJECT_DEPENDS ${snippet_src})
|
||||||
|
else()
|
||||||
|
message("skip snippet ${snippet_src} because compiler does not support C++11")
|
||||||
|
endif()
|
||||||
endforeach(snippet_src)
|
endforeach(snippet_src)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user