Skip to content

Commit 4ed6f55

Browse files
committed
add cmake debugging for version
1 parent 4c77cca commit 4ed6f55

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

CMakeLists.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ project(
99
VERSION 0.0.1
1010
)
1111

12+
# gersemi: off
13+
14+
# Modules opt in only on compilers that support g++-15 and clang-20
15+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20)
16+
set(CMAKE_CXX_SCAN_FOR_MODULES 1)
17+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
18+
set(CMAKE_CXX_SCAN_FOR_MODULES 1)
19+
elseif()
20+
set(CMAKE_CXX_SCAN_FOR_MODULES 0)
21+
endif()
22+
1223
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1324

1425
# [CMAKE.SKIP_TESTS]
@@ -31,24 +42,15 @@ option(
3142
${PROJECT_IS_TOP_LEVEL}
3243
)
3344

34-
# gersemi: off
35-
3645
message(
3746
"Compiler is: ${CMAKE_CXX_COMPILER_ID} version: ${CMAKE_CXX_COMPILER_VERSION}"
3847
)
39-
40-
# Modules opt in only on compilers that support g++-15 and clang-20
41-
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20)
42-
set(CMAKE_CXX_SCAN_FOR_MODULES 1)
43-
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
44-
set(CMAKE_CXX_SCAN_FOR_MODULES 1)
45-
elseif()
46-
set(CMAKE_CXX_SCAN_FOR_MODULES 0)
47-
endif()
48+
message(
49+
"cmake is: ${CMAKE_VERSION} modules scan : ${CMAKE_CXX_SCAN_FOR_MODULES}"
50+
)
4851

4952
if(CMAKE_CXX_SCAN_FOR_MODULES)
5053
add_library(beman.scope)
51-
# target_compile_features(beman.scope PRIVATE cxx_std_23)
5254
target_sources(
5355
beman.scope
5456
PUBLIC
@@ -62,7 +64,6 @@ if(CMAKE_CXX_SCAN_FOR_MODULES)
6264
)
6365
else()
6466
add_library(beman.scope INTERFACE)
65-
# target_compile_features(beman.scope INTERFACE cxx_std_20)
6667
target_sources(
6768
beman.scope
6869
INTERFACE

0 commit comments

Comments
 (0)