1- cmake_minimum_required (VERSION 3.14...3.21)
2- project (fortran2018io
3- LANGUAGES Fortran)
4- enable_testing ()
5-
61set_directory_properties (PROPERTIES LABELS io)
72
8- if (f08block)
9- add_library (logging OBJECT logging.f90)
3+ add_library (logging OBJECT logging.f90)
104
11- add_executable (append_file append_file.f90)
12- target_link_libraries (append_file PRIVATE logging pathlib)
13- add_test (NAME io:appendFile COMMAND append_file)
14- endif (f08block)
5+ add_executable (append_file append_file.f90)
6+ target_link_libraries (append_file PRIVATE logging pathlib)
7+ add_test (NAME io:appendFile COMMAND append_file)
158
169add_executable (termio terminal_io.f90)
17- if ( NOT WIN32 )
18- add_test ( NAME io:terminal COMMAND bash -c "$<TARGET_FILE:termio> <<< 0" )
19- endif ( )
10+ add_test ( NAME io:terminal COMMAND bash -c "$<TARGET_FILE:termio> <<< 0" )
11+ set_tests_properties ( io:terminal PROPERTIES DISABLED $< BOOL : ${WIN32} >
12+ )
2013
2114add_executable (leading_zeros leading_zeros.f90)
2215add_test (NAME io:leading_zeros COMMAND leading_zeros)
@@ -34,25 +27,14 @@ add_executable(null devnull.f90)
3427add_test (NAME io:nullfile COMMAND null)
3528
3629# --- pathlib
37- add_library (pathlib OBJECT pathlib.f90)
38- if (WIN32 )
39- target_sources (pathlib PRIVATE pathlib_windows.f90)
40- else ()
41- target_sources (pathlib PRIVATE pathlib_unix.f90)
42- endif ()
43- if (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel" )
44- target_sources (pathlib PRIVATE pathlib_intel.f90)
45- else ()
46- target_sources (pathlib PRIVATE pathlib_gcc.f90)
47- endif ()
30+ add_library (pathlib OBJECT pathlib.f90
31+ $<IF:$<BOOL :${WIN32} >,pathlib_windows.f90,pathlib_unix.f90>
32+ $<IF:$<Fortran_COMPILER_ID:Intel,IntelLLVM>,pathlib_intel.f90,pathlib_gcc.f90>
33+ )
4834
4935add_executable (test_pathlib test_pathlib.f90)
5036target_link_libraries (test_pathlib pathlib)
5137add_test (NAME io:pathlib COMMAND $<TARGET_FILE:test_pathlib>)
5238
5339# future, when c++17 filesystem is better supported in general.
54- # if(posixio_OK)
55- # add_executable(realpath realpath_posix.f90)
56- # elseif(windowsio_OK)
57- # add_executable(realpath fullpath_windows.f90)
58- # endif()
40+ # add_executable(realpath $<IF:$<BOOL:${posixio_OK}>,realpath_posix.f90,fullpath_windows.f90>)
0 commit comments