Skip to content

Commit 4f9784b

Browse files
committed
Fix make check on windows & flags on windows
- Make check needs a generator expression to tell CTest which config to use - We need to set appropriate intel flags based on *nix or Windows
1 parent 13ca9db commit 4f9784b

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
cmake_minimum_required ( VERSION 2.8.8 FATAL_ERROR )
1313

14+
# Use MSVS folders to organize projects on windows
15+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
16+
1417
set(PROJECT_DESCRIPTION "A Fortran 2008 JSON API")
1518
set(PROJECT_URL "https://github.com/jacobwilliams/json-fortran")
1619

@@ -239,7 +242,7 @@ if ( ENABLE_TESTS )
239242
enable_testing()
240243

241244
# emulate GNU Autotools `make check`
242-
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
245+
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>)
243246

244247
find_program ( JSONLINT jsonlint )
245248
find_program ( DIFF diff )

cmake/pickFortranCompilerFlags.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,26 @@ if ( NOT Fortran_FLAGS_INIT )
88
"Enable compiler run-time checks? (Enabling this will turn off most compiler optimizations.)" )
99
mark_as_advanced ( ENABLE_RUNTIME_CHECKS )
1010

11+
if ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" )
12+
set(pre /)
13+
set(spc :)
14+
set(Q /Q)
15+
else()
16+
set(pre -)
17+
set(spc " ")
18+
set(Q -)
19+
endif()
1120
if ( "${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" )
21+
set(TRACE_FLAG -traceback)
1222
if ( ENABLE_BACK_TRACE )
13-
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -traceback")
23+
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${pre}traceback")
1424
endif ()
1525
if ( ENABLE_COMPILE_TIME_WARNINGS )
1626
# The following warning might be triggered by ifort unless explicitly silenced:
1727
# warning #7601: F2008 standard does not allow an internal procedure to be an actual argument procedure
1828
# name. (R1214.4). In the context of F2008 this is an erroneous warning.
1929
# See https://prd1idz.cps.intel.com/en-us/forums/topic/486629
20-
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn -stand f08 -diag-disable 7601 -diag-disable 5142" )
30+
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${pre}warn ${pre}stand${spc}f08 ${Q}diag-disable${spc}7601 ${Q}diag-disable${spc}5142" )
2131
endif ()
2232
if ( ENABLE_RUNTIME_CHECKS )
2333
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -check all" )

0 commit comments

Comments
 (0)