Skip to content

Commit

Permalink
cmake: Migrate to C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Sep 13, 2023
1 parent fb12fcd commit 205b73c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Bar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_include_directories(Bar
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(Bar PUBLIC cxx_std_17)
target_compile_features(Bar PUBLIC cxx_std_20)
set_target_properties(Bar PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER include/bar/Bar.hpp)
Expand Down
2 changes: 1 addition & 1 deletion Foo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target_include_directories(Foo
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(Foo PUBLIC cxx_std_17)
target_compile_features(Foo PUBLIC cxx_std_20)
set_target_properties(Foo PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER include/foo/Foo.hpp)
Expand Down
2 changes: 1 addition & 1 deletion FooBar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_include_directories(FooBar
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(FooBar PUBLIC cxx_std_17)
target_compile_features(FooBar PUBLIC cxx_std_20)
set_target_properties(FooBar PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER include/foobar/FooBar.hpp)
Expand Down
2 changes: 1 addition & 1 deletion FooBarApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ add_executable(FooBarApp)
target_sources(FooBarApp
PRIVATE
src/main.cpp)
target_compile_features(FooBarApp PRIVATE cxx_std_17)
target_compile_features(FooBarApp PRIVATE cxx_std_20)
set_target_properties(FooBarApp PROPERTIES
VERSION ${PROJECT_VERSION})
# note: macOS is APPLE and also UNIX !
Expand Down
6 changes: 3 additions & 3 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -76,7 +76,7 @@ function(add_cpp_test FILE_NAME)

add_executable(${TEST_NAME} ${FILE_NAME})
target_include_directories(${TEST_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(${TEST_NAME} PRIVATE cxx_std_17)
target_compile_features(${TEST_NAME} PRIVATE cxx_std_20)
target_link_libraries(${TEST_NAME} PRIVATE
Catch2 Catch2WithMain
${PROJECT_NAMESPACE}::Foo
Expand Down Expand Up @@ -136,7 +136,7 @@ function(add_cpp_example FILE_NAME)

add_executable(${EXAMPLE_NAME} ${FILE_NAME})
target_include_directories(${EXAMPLE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(${EXAMPLE_NAME} PRIVATE cxx_std_17)
target_compile_features(${EXAMPLE_NAME} PRIVATE cxx_std_20)
target_link_libraries(${EXAMPLE_NAME} PRIVATE
${PROJECT_NAMESPACE}::Foo
${PROJECT_NAMESPACE}::Bar
Expand Down

0 comments on commit 205b73c

Please sign in to comment.