cmake: Set CXX_STANDARD to 11 on examples and tests

This commit is contained in:
Joshua Scott 2018-03-29 15:48:20 +01:00
parent 54c1e509f6
commit 21ccbf0cd7
3 changed files with 17 additions and 0 deletions

9
.gitignore vendored
View File

@ -33,3 +33,12 @@
*.exe *.exe
*.out *.out
*.app *.app
# Debug
*.pdb
# Incremental Linker
*.ilk
# Build directory
build/

View File

@ -2,5 +2,9 @@ file(GLOB files "src/example-*.cpp")
foreach (file ${files}) foreach (file ${files})
get_filename_component(file_basename ${file} NAME_WE) get_filename_component(file_basename ${file} NAME_WE)
add_executable(${file_basename} ${file}) add_executable(${file_basename} ${file})
set_target_properties(${file_basename}
PROPERTIES
CXX_STANDARD 11
)
target_link_libraries(${file_basename} ${PROJECT_NAME}) target_link_libraries(${file_basename} ${PROJECT_NAME})
endforeach() endforeach()

View File

@ -8,6 +8,10 @@ foreach (file ${files})
string(REGEX REPLACE "unit-([^$]+)" "test-\\1" testcase ${file_basename}) string(REGEX REPLACE "unit-([^$]+)" "test-\\1" testcase ${file_basename})
add_executable(${testcase} ${file}) add_executable(${testcase} ${file})
set_target_properties(${testcase}
PROPERTIES
CXX_STANDARD 11
)
target_link_libraries(${testcase} Catch ${PROJECT_NAME}) target_link_libraries(${testcase} Catch ${PROJECT_NAME})
add_test(${testcase} ${testcase}) add_test(${testcase} ${testcase})
endforeach() endforeach()