1- cmake_minimum_required (VERSION 3.19...3.29 )
1+ cmake_minimum_required (VERSION 3.19...3.30 )
22
33if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
44 message (FATAL_ERROR "In-source builds are not allowed. Do like:
@@ -27,19 +27,19 @@ file(GENERATE OUTPUT .gitignore CONTENT "*")
2727if (find )
2828 find_package (NetCDF COMPONENTS C Fortran)
2929endif ()
30- if (NOT NetCDF_FOUND)
30+ if (NOT NetCDF_FOUND AND NOT TARGET NetCDF::NetCDF_Fortran )
3131 include (cmake/netcdf.cmake)
3232endif ()
3333
3434# --- code coverage
35- if (${PROJECT_NAME} _COVERAGE AND ${PROJECT_NAME} _IS_TOP_LEVEL )
35+ if (nc4fortran_COVERAGE AND nc4fortran_IS_TOP_LEVEL )
3636 include (cmake/Modules/CodeCoverage.cmake)
3737 append_coverage_compiler_flags()
3838 set (COVERAGE_EXCLUDES ${PROJECT_SOURCE_DIR} /test )
3939endif ()
4040
4141# --- clang-tidy
42- if (tidy AND ${PROJECT_NAME} _IS_TOP_LEVEL )
42+ if (tidy AND nc4fortran_IS_TOP_LEVEL )
4343 find_program (CLANG_TIDY_EXE NAMES "clang-tidy" REQUIRED)
4444 set (CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} )
4545endif ()
@@ -66,7 +66,7 @@ target_link_libraries(nc4fortran::nc4fortran INTERFACE nc4fortran)
6666
6767install (FILES ${CMAKE_CURRENT_BINARY_DIR} /include /nc4fortran.mod TYPE INCLUDE )
6868
69- install (TARGETS nc4fortran EXPORT ${PROJECT_NAME} -targets)
69+ install (TARGETS nc4fortran EXPORT nc4fortran -targets)
7070
7171# additional Find*.cmake necessary
7272install (FILES
@@ -76,7 +76,7 @@ DESTINATION cmake
7676)
7777
7878
79- if (${PROJECT_NAME} _BUILD_TESTING )
79+ if (nc4fortran_BUILD_TESTING )
8080 add_subdirectory (test )
8181endif ()
8282
0 commit comments