Skip to content

Commit 5c47dd5

Browse files
authored
Check for Fortran to guard build target (#48)
1 parent 0320c8a commit 5c47dd5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ cmake_minimum_required(VERSION 3.10)
1515
#
1616
# project information
1717
#
18-
project("test" LANGUAGES C Fortran)
18+
project("test" LANGUAGES C)
19+
20+
#
21+
# check for Fortran support
22+
#
23+
include(CheckLanguage)
24+
check_language(Fortran)
25+
if(CMAKE_Fortran_COMPILER)
26+
enable_language(Fortran)
1927

2028

2129
#

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
add_subdirectory(libfoo)
1414
add_subdirectory(bar)
1515
add_subdirectory(libheader)
16-
add_subdirectory(fortran)
16+
17+
if(CMAKE_Fortran_COMPILER)
18+
add_subdirectory(fortran)
19+
endif()

0 commit comments

Comments
 (0)