Skip to content

Commit 40492b9

Browse files
committed
verify CMake 3.11+ compatibility
1 parent f74daac commit 40492b9

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

cmake/compilers.cmake

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ endif()
2424
# --- C compile flags
2525
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|^Intel")
2626
add_compile_options(
27-
"$<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Debug>>:-Wextra>"
28-
"$<$<COMPILE_LANGUAGE:C,CXX>:-Wall>"
27+
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:-Wextra>"
28+
"$<$<COMPILE_LANGUAGE:C>:-Wall>"
2929
"$<$<COMPILE_LANGUAGE:C>:-Werror=implicit-function-declaration>"
3030
)
3131
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
32-
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/W3>")
32+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:/W3>")
3333
endif()
3434

3535
if(WIN32)
3636
if(CMAKE_C_COMPILER_ID MATCHES "^Intel|MSVC")
37-
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Debug>>:/Od>)
37+
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:/Od>)
3838
endif()
3939
elseif(CMAKE_C_COMPILER_ID MATCHES "^Intel")
40-
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Debug>>:-O0>)
40+
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:-O0>)
4141
endif()
4242

4343
# --- Fortran compile flags
@@ -48,6 +48,12 @@ add_compile_options(
4848
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-traceback;-check;-debug>"
4949
)
5050

51+
if(WIN32)
52+
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:/Od>)
53+
else()
54+
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-O0>)
55+
endif()
56+
5157
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
5258

5359
add_compile_options(
@@ -58,13 +64,6 @@ add_compile_options(
5864

5965
endif()
6066

61-
62-
if(WIN32)
63-
add_compile_options($<$<AND:$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>,$<CONFIG:Debug>>:/Od>)
64-
else()
65-
add_compile_options($<$<AND:$<COMPILE_LANG_AND_ID:Fortran,Intel,IntelLLVM>,$<CONFIG:Debug>>:-O0>)
66-
endif()
67-
6867
# --- code coverage
6968
if(ENABLE_COVERAGE)
7069
include(${CMAKE_CURRENT_LIST_DIR}/Modules/CodeCoverage.cmake)

cmake/options.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} Toolch
22

33
include(GNUInstallDirs)
44

5-
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION}")
6-
75
option(ENABLE_COVERAGE "Code coverage tests")
86
option(tidy "Run clang-tidy on the code")
97

test/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
set_property(DIRECTORY PROPERTY LABELS h5fortran)
55

6-
add_compile_options("$<$<COMPILE_LANG_AND_ID:Fortran,GNU>:-Wno-compare-reals;-Wno-maybe-uninitialized>")
6+
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
7+
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-Wno-compare-reals;-Wno-maybe-uninitialized>")
8+
endif()
79

810
set(attr_file ${CMAKE_CURRENT_BINARY_DIR}/test_attr_py.h5)
911
set(shape_file ${CMAKE_CURRENT_BINARY_DIR}/test_shape.h5)

0 commit comments

Comments
 (0)