|
8 | 8 | include (EkatUtils) |
9 | 9 | macro(BuildCprnc) |
10 | 10 |
|
11 | | - # Make sure this is built only once |
12 | | - if (NOT TARGET cprnc) |
13 | | - if (SCREAM_CIME_BUILD) |
14 | | - string (CONCAT MSG |
15 | | - "WARNING! By default, scream should not build tests in a CIME build,\n" |
16 | | - "and cprnc should only be built by scream in case tests are enabled.\n" |
17 | | - "If you explicitly requested tests to be on in a CIME build,\n" |
18 | | - "then you can discard this warning. Otherwise, please, contact developers.\n") |
19 | | - message("${MSG}") |
20 | | - endif() |
21 | | - set(BLDROOT ${PROJECT_BINARY_DIR}/externals/cprnc) |
22 | | - file(WRITE ${BLDROOT}/Macros.cmake |
23 | | - " |
24 | | - set(SCC ${CMAKE_C_COMPILER}) |
25 | | - set(SFC ${CMAKE_Fortran_COMPILER}) |
26 | | - set(FFLAGS \"${CMAKE_Fortran_FLAGS}\") |
27 | | - set(NETCDF_PATH ${NetCDF_Fortran_PATH}) |
28 | | - " |
29 | | - ) |
30 | | - set(SRC_ROOT ${SCREAM_BASE_DIR}/../..) |
31 | | - add_subdirectory(${SRC_ROOT}/cime/CIME/non_py/cprnc ${BLDROOT}) |
32 | | - EkatDisableAllWarning(cprnc) |
33 | | - |
34 | | - set(CPRNC_BINARY ${BLDROOT}/cprnc CACHE INTERNAL "") |
35 | | - |
| 11 | + # TODO: handle this more carefully and more gracefully in the future |
| 12 | + # TODO: For now, it is just a hack to get going... |
| 13 | + # find cprnc defined in machine entries |
| 14 | + set(CCSM_CPRNC $ENV{CCSM_CPRNC}) |
| 15 | + if(EXISTS "${CCSM_CPRNC}") |
| 16 | + message(STATUS "Path ${CCSM_CPRNC} exists, so we will use it") |
| 17 | + set(CPRNC_BINARY ${CCSM_CPRNC} CACHE INTERNAL "") |
36 | 18 | configure_file (${SCREAM_BASE_DIR}/cmake/CprncTest.cmake.in |
37 | 19 | ${CMAKE_BINARY_DIR}/bin/CprncTest.cmake @ONLY) |
| 20 | + else() |
| 21 | + message(WARNING "Path ${CCSM_CPRNC} does not exist, so we will try to build it") |
| 22 | + # Make sure this is built only once |
| 23 | + if (NOT TARGET cprnc) |
| 24 | + if (SCREAM_CIME_BUILD) |
| 25 | + string (CONCAT MSG |
| 26 | + "WARNING! By default, scream should not build tests in a CIME build,\n" |
| 27 | + "and cprnc should only be built by scream in case tests are enabled.\n" |
| 28 | + "If you explicitly requested tests to be on in a CIME build,\n" |
| 29 | + "then you can discard this warning. Otherwise, please, contact developers.\n") |
| 30 | + message("${MSG}") |
| 31 | + endif() |
| 32 | + set(BLDROOT ${PROJECT_BINARY_DIR}/externals/cprnc) |
| 33 | + file(WRITE ${BLDROOT}/Macros.cmake |
| 34 | + " |
| 35 | + set(SCC ${CMAKE_C_COMPILER}) |
| 36 | + set(SFC ${CMAKE_Fortran_COMPILER}) |
| 37 | + set(FFLAGS \"${CMAKE_Fortran_FLAGS}\") |
| 38 | + set(NETCDF_PATH ${NetCDF_Fortran_PATH}) |
| 39 | + " |
| 40 | + ) |
| 41 | + set(SRC_ROOT ${SCREAM_BASE_DIR}/../..) |
| 42 | + add_subdirectory(${SRC_ROOT}/cime/CIME/non_py/cprnc ${BLDROOT}) |
| 43 | + EkatDisableAllWarning(cprnc) |
| 44 | + |
| 45 | + set(CPRNC_BINARY ${BLDROOT}/cprnc CACHE INTERNAL "") |
| 46 | + |
| 47 | + configure_file (${SCREAM_BASE_DIR}/cmake/CprncTest.cmake.in |
| 48 | + ${CMAKE_BINARY_DIR}/bin/CprncTest.cmake @ONLY) |
| 49 | + endif() |
38 | 50 | endif() |
39 | 51 | endmacro() |
0 commit comments