|
9 | 9 | # this software. The contributing author, Izaak Beekman, retains all
|
10 | 10 | # rights permitted by the terms of the JSON-Fortran license.
|
11 | 11 |
|
12 |
| -cmake_minimum_required ( VERSION 2.8.8 FATAL_ERROR ) |
| 12 | +cmake_minimum_required ( VERSION 3.18 FATAL_ERROR ) |
| 13 | + |
| 14 | +option (JSONFORTRAN_ENABLE_DOC_GENERATION "Enable doc generation" OFF) |
| 15 | +option (JSONFORTRAN_ENABLE_TESTS "Enable tests" OFF) |
| 16 | +option (JSONFORTRAN_STATIC_LIBRARY_ONLY "Generate only static library" ON) |
13 | 17 |
|
14 | 18 | # Use MSVS folders to organize projects on windows
|
15 | 19 | set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
@@ -174,8 +178,12 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL IntelLLVM)
|
174 | 178 | add_library ( ${LIB_NAME} SHARED $<TARGET_OBJECTS:${LIB_NAME}-obj> )
|
175 | 179 | add_library ( ${LIB_NAME}-static STATIC $<TARGET_OBJECTS:${LIB_NAME}-obj> )
|
176 | 180 | else()
|
177 |
| - add_library ( ${LIB_NAME} SHARED ${JF_LIB_SRCS} ) |
| 181 | + if (JSONFORTRAN_STATIC_LIBRARY_ONLY) |
| 182 | + add_library ( ${LIB_NAME} STATIC ${JF_LIB_SRCS} ) |
178 | 183 | add_library ( ${LIB_NAME}-static STATIC ${JF_LIB_SRCS} )
|
| 184 | + else() |
| 185 | + add_library ( ${LIB_NAME} SHARED ${JF_LIB_SRCS} ) |
| 186 | + endif() |
179 | 187 | endif()
|
180 | 188 |
|
181 | 189 | if(JSON_FORTRAN_USE_OpenCoarrays)
|
@@ -227,6 +235,10 @@ set_target_properties ( ${LIB_NAME}
|
227 | 235 | #-------------------------------------
|
228 | 236 | # Build the documentation with FORD
|
229 | 237 | #-------------------------------------
|
| 238 | +if (JSONFORTRAN_ENABLE_DOC_GENERATION) |
| 239 | + set(SKIP_DOC_GEN FALSE) |
| 240 | +endif () |
| 241 | + |
230 | 242 | set ( SKIP_DOC_GEN FALSE CACHE BOOL
|
231 | 243 | "Disable building the API documentation with FORD" )
|
232 | 244 | if ( NOT SKIP_DOC_GEN )
|
@@ -301,6 +313,9 @@ endif ()
|
301 | 313 | #--------------------------
|
302 | 314 | # Handle test related stuff
|
303 | 315 | #--------------------------
|
| 316 | +if (JSONFORTRAN_ENABLE_TESTS) |
| 317 | + set (ENABLE_TESTS FALSE) |
| 318 | +endif () |
304 | 319 | set ( ENABLE_TESTS TRUE CACHE BOOL
|
305 | 320 | "Enable the JSON-Fortran tests." )
|
306 | 321 |
|
|
0 commit comments