2024-01-18 05:17:50 +08:00
|
|
|
################################
|
|
|
|
# Macros
|
|
|
|
################################
|
|
|
|
|
2024-01-11 06:11:00 +08:00
|
|
|
macro(set_std_filter filter)
|
2024-01-18 05:47:16 +08:00
|
|
|
# Upper case the filter name
|
|
|
|
string(TOUPPER "${filter}" upfilter)
|
|
|
|
string(TOLOWER "${filter}" downfilter)
|
|
|
|
if(ENABLE_FILTER_${upfilter})
|
|
|
|
# Define a test flag for filter
|
|
|
|
if(${filter}_FOUND)
|
|
|
|
include_directories(${${filter}_INCLUDE_DIRS})
|
|
|
|
set(ENABLE_${upfilter} TRUE)
|
|
|
|
set(HAVE_${upfilter} ON)
|
|
|
|
set(STD_FILTERS "${STD_FILTERS} ${downfilter}")
|
|
|
|
message(">>> Standard Filter: ${downfilter}")
|
|
|
|
else()
|
|
|
|
set(ENABLE_${upfilter} FALSE)
|
|
|
|
set(HAVE_${upfilter} OFF)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAVE_${upfilter} OFF)
|
|
|
|
endif()
|
2024-01-18 05:17:50 +08:00
|
|
|
endmacro(set_std_filter)
|
|
|
|
|
|
|
|
macro(getuname name flag)
|
2024-01-18 05:47:16 +08:00
|
|
|
execute_process(COMMAND "${UNAME}" "${flag}" OUTPUT_VARIABLE "${name}" OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2024-01-18 05:17:50 +08:00
|
|
|
endmacro(getuname)
|
|
|
|
|
|
|
|
# A macro to check if a C linker supports a particular flag.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(CHECK_C_LINKER_FLAG M_FLAG M_RESULT)
|
|
|
|
set(T_REQ_FLAG "${CMAKE_REQUIRED_FLAGS}")
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${M_FLAG}")
|
2024-01-18 05:17:50 +08:00
|
|
|
CHECK_C_SOURCE_COMPILES("int main() {return 0;}" ${M_RESULT})
|
2024-01-18 05:47:16 +08:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "${T_REQ_FLAG}")
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Macro for replacing '/MD' with '/MT'.
|
|
|
|
# Used only on Windows, /MD tells VS to use the shared
|
|
|
|
# CRT libs, MT tells VS to use the static CRT libs.
|
|
|
|
#
|
|
|
|
# Taken From:
|
|
|
|
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
|
|
|
|
#
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(specify_static_crt_flag)
|
|
|
|
set(vars
|
2024-01-18 05:17:50 +08:00
|
|
|
CMAKE_C_FLAGS
|
|
|
|
CMAKE_C_FLAGS_DEBUG
|
|
|
|
CMAKE_C_FLAGS_RELEASE
|
|
|
|
CMAKE_C_FLAGS_MINSIZEREL
|
|
|
|
CMAKE_C_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG
|
|
|
|
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
|
|
|
|
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
|
|
|
2024-01-18 05:47:16 +08:00
|
|
|
foreach(flag_var ${vars})
|
|
|
|
if(${flag_var} MATCHES "/MD")
|
|
|
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
2024-01-18 05:47:16 +08:00
|
|
|
foreach(flag_var ${vars})
|
|
|
|
message(STATUS " '${flag_var}': ${${flag_var}}")
|
|
|
|
endforeach()
|
|
|
|
message(STATUS "")
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Macro to append files to the EXTRA_DIST files.
|
|
|
|
# Note: can only be used in subdirectories because of the use of PARENT_SCOPE
|
2024-01-18 05:47:16 +08:00
|
|
|
set(EXTRA_DIST "")
|
|
|
|
macro(ADD_EXTRA_DIST files)
|
|
|
|
foreach(F ${files})
|
|
|
|
set(EXTRA_DIST ${EXTRA_DIST} ${CMAKE_CURRENT_SOURCE_DIR}/${F})
|
|
|
|
set(EXTRA_DIST ${EXTRA_DIST} PARENT_SCOPE)
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(GEN_m4 filename)
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
set(fallbackdest "${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c")
|
|
|
|
set(dest "${CMAKE_CURRENT_BINARY_DIR}/${filename}.c")
|
|
|
|
|
|
|
|
# If m4 isn't present, and the generated file doesn't exist,
|
|
|
|
# it cannot be generated and an error should be thrown.
|
2024-01-19 05:07:13 +08:00
|
|
|
if(NOT HAVE_M4)
|
2024-01-18 05:47:16 +08:00
|
|
|
if(NOT EXISTS ${fallbackdest})
|
|
|
|
message(FATAL_ERROR "m4 is required to generate ${filename}.c. Please install m4 so that it is on the PATH and try again.")
|
|
|
|
else()
|
|
|
|
set(dest ${fallbackdest})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
add_custom_command(
|
2024-01-18 05:17:50 +08:00
|
|
|
OUTPUT ${dest}
|
|
|
|
COMMAND ${NC_M4}
|
|
|
|
ARGS ${M4FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.m4 > ${dest}
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
endmacro(GEN_m4)
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Binary tests, but ones which depend on value of 'TEMP_LARGE' being defined.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(add_bin_env_temp_large_test prefix F)
|
|
|
|
add_executable(${prefix}_${F} ${F}.c)
|
|
|
|
target_link_libraries(${prefix}_${F} netcdf)
|
2024-01-18 05:17:50 +08:00
|
|
|
IF(MSVC)
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${prefix}_${F}
|
2024-01-18 05:17:50 +08:00
|
|
|
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
2024-01-18 05:47:16 +08:00
|
|
|
add_test(${prefix}_${F} bash "-c" "TEMP_LARGE=${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${prefix}_${F}")
|
|
|
|
if(MSVC)
|
|
|
|
set_property(TARGET ${prefix}_${F} PROPERTY FOLDER "tests")
|
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Tests which are binary, but depend on a particular environmental variable.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(add_bin_env_test prefix F)
|
|
|
|
add_executable(${prefix}_${F} ${F}.c)
|
|
|
|
target_link_libraries(${prefix}_${F} netcdf)
|
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${prefix}_${F}
|
2024-01-18 05:17:50 +08:00
|
|
|
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
2024-01-18 05:47:16 +08:00
|
|
|
add_test(${prefix}_${F} bash "-c" "TOPSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${prefix}_${F}")
|
|
|
|
if(MSVC)
|
|
|
|
set_property(TARGET ${prefix}_${F} PROPERTY FOLDER "tests")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Build a binary used by a script, but don't make a test out of it.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(build_bin_test F)
|
2024-01-18 05:17:50 +08:00
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${F}.c")
|
2024-01-18 05:47:16 +08:00
|
|
|
add_executable(${F} "${CMAKE_CURRENT_SOURCE_DIR}/${F}.c" ${ARGN})
|
2024-01-18 05:17:50 +08:00
|
|
|
else()
|
|
|
|
# File should have been copied to the binary directory
|
2024-01-18 05:47:16 +08:00
|
|
|
add_executable(${F} "${CMAKE_CURRENT_BINARY_DIR}/${F}.c" ${ARGN})
|
2024-01-18 05:17:50 +08:00
|
|
|
endif()
|
2024-01-18 05:47:16 +08:00
|
|
|
target_link_libraries(${F} netcdf ${ALL_TLL_LIBS})
|
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${F}
|
2024-01-18 05:17:50 +08:00
|
|
|
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Binary tests which are used by a script looking for a specific name.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(add_bin_test_no_prefix F)
|
2024-01-18 05:17:50 +08:00
|
|
|
build_bin_test(${F} ${ARGN})
|
2024-01-18 05:47:16 +08:00
|
|
|
add_test(${F} ${EXECUTABLE_OUTPUT_PATH}/${F})
|
|
|
|
if(MSVC)
|
|
|
|
set_property(TEST ${F} PROPERTY FOLDER "tests/")
|
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Binary tests which are used by a script looking for a specific name.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(build_bin_test_no_prefix F)
|
2024-01-18 05:17:50 +08:00
|
|
|
build_bin_test(${F})
|
2024-01-18 05:47:16 +08:00
|
|
|
if(MSVC)
|
2024-01-18 05:17:50 +08:00
|
|
|
#SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/")
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# Build a test and add it to the test list.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(add_bin_test prefix F)
|
|
|
|
add_executable(${prefix}_${F} ${F}.c ${ARGN})
|
|
|
|
target_link_libraries(${prefix}_${F}
|
2024-01-18 05:17:50 +08:00
|
|
|
${ALL_TLL_LIBS}
|
|
|
|
netcdf
|
|
|
|
)
|
2024-01-18 05:47:16 +08:00
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${prefix}_${F}
|
2024-01-18 05:17:50 +08:00
|
|
|
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"
|
|
|
|
)
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
add_test(${prefix}_${F}
|
2024-01-18 05:17:50 +08:00
|
|
|
${EXECUTABLE_OUTPUT_PATH}/${prefix}_${F}
|
|
|
|
)
|
2024-01-18 05:47:16 +08:00
|
|
|
if(MSVC)
|
|
|
|
set_property(TEST ${prefix}_${F} PROPERTY FOLDER "tests/")
|
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
set_target_properties(${prefix}_${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
2024-01-18 05:17:50 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2024-01-18 05:47:16 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# A cmake script to print out information at the end of the configuration step.
|
2024-01-18 05:47:16 +08:00
|
|
|
macro(print_conf_summary)
|
|
|
|
message("")
|
|
|
|
message("")
|
|
|
|
message("Configuration Summary:")
|
|
|
|
message("")
|
|
|
|
message(STATUS "Building Shared Libraries: ${BUILD_SHARED_LIBS}")
|
|
|
|
message(STATUS "Building netCDF-4: ${ENABLE_NETCDF_4}")
|
|
|
|
message(STATUS "Building DAP2 Support: ${ENABLE_DAP2}")
|
|
|
|
message(STATUS "Building DAP4 Support: ${ENABLE_DAP4}")
|
|
|
|
message(STATUS "Building Byte-range Support: ${ENABLE_BYTERANGE}")
|
|
|
|
message(STATUS "Building Utilities: ${BUILD_UTILITIES}")
|
|
|
|
if(CMAKE_PREFIX_PATH)
|
|
|
|
message(STATUS "CMake Prefix Path: ${CMAKE_PREFIX_PATH}")
|
|
|
|
endif()
|
|
|
|
message("")
|
|
|
|
|
|
|
|
if(${STATUS_PNETCDF} OR ${STATUS_PARALLEL})
|
|
|
|
message("Building Parallel NetCDF")
|
|
|
|
message(STATUS "Using PnetCDF: ${STATUS_PNETCDF}")
|
|
|
|
message(STATUS "Using Parallel IO: ${STATUS_PARALLEL}")
|
|
|
|
message("")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message("Tests Enabled: ${ENABLE_TESTS}")
|
|
|
|
if(ENABLE_TESTS)
|
|
|
|
message(STATUS "DAP Remote Tests: ${ENABLE_DAP_REMOTE_TESTS}")
|
|
|
|
message(STATUS "Extra Tests: ${ENABLE_EXTRA_TESTS}")
|
|
|
|
message(STATUS "Coverage Tests: ${ENABLE_COVERAGE_TESTS}")
|
|
|
|
message(STATUS "Parallel Tests: ${ENABLE_PARALLEL_TESTS}")
|
|
|
|
message(STATUS "Large File Tests: ${ENABLE_LARGE_FILE_TESTS}")
|
|
|
|
message(STATUS "Extreme Numbers: ${ENABLE_EXTREME_NUMBERS}")
|
|
|
|
message(STATUS "Unit Tests: ${ENABLE_UNIT_TESTS}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message("")
|
|
|
|
message("Compiler:")
|
|
|
|
message("")
|
|
|
|
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
|
|
|
|
message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
|
|
|
|
message(STATUS "CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
|
|
|
endif()
|
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
|
|
|
message(STATUS "CMAKE_C_FLAGS_RELEASE: ${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "Linking against: ${ALL_TLL_LIBS}")
|
|
|
|
|
|
|
|
message("")
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(add_sh_test prefix F)
|
|
|
|
if(HAVE_BASH)
|
|
|
|
add_test(${prefix}_${F} bash "-c" "export srcdir=${CMAKE_CURRENT_SOURCE_DIR};export TOPSRCDIR=${CMAKE_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}/${F}.sh ${ARGN}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
2024-01-18 23:15:20 +08:00
|
|
|
macro(getdpkg_arch arch)
|
|
|
|
execute_process(COMMAND "${NC_DPKG}" "--print-architecture" OUTPUT_VARIABLE "${arch}" OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
endmacro(getdpkg_arch)
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
################################
|
|
|
|
# Functions
|
|
|
|
################################
|
|
|
|
|
|
|
|
function(booleanize VALUE RETVAR)
|
|
|
|
# force case
|
2024-01-18 05:47:16 +08:00
|
|
|
string(TOLOWER "${VALUE}" LCVALUE)
|
2024-01-18 05:17:50 +08:00
|
|
|
# Now do all the comparisons
|
|
|
|
if(LCVALUE IN_LIST TRUELIST OR LCVALUE GREATER 0)
|
2024-01-18 05:47:16 +08:00
|
|
|
set(${RETVAR} TRUE PARENT_SCOPE)
|
2024-01-18 05:17:50 +08:00
|
|
|
elseif(LCVALUE IN_LIST FALSELIST OR LCVALUE MATCHES ".*-notfound" OR LCVALUE STREQUAL "")
|
2024-01-18 05:47:16 +08:00
|
|
|
set(${RETVAR} FALSE PARENT_SCOPE)
|
2024-01-18 05:17:50 +08:00
|
|
|
else()
|
2024-01-18 05:47:16 +08:00
|
|
|
set(${RETVAR} NOTFOUND PARENT_SCOPE)
|
2024-01-18 05:17:50 +08:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
|
|
# A function used to create autotools-style 'yes/no' definitions.
|
|
|
|
# If a variable is set, it 'yes' is returned. Otherwise, 'no' is
|
|
|
|
# returned.
|
|
|
|
#
|
|
|
|
# Also creates a version of the ret_val prepended with 'NC',
|
|
|
|
# when feature is true, which is used to generate netcdf_meta.h.
|
2024-01-18 05:47:16 +08:00
|
|
|
function(is_enabled feature ret_val)
|
|
|
|
if(${feature})
|
|
|
|
set(${ret_val} "yes" PARENT_SCOPE)
|
|
|
|
set("NC_${ret_val}" 1 PARENT_SCOPE)
|
|
|
|
else()
|
|
|
|
set(${ret_val} "no" PARENT_SCOPE)
|
|
|
|
set("NC_${ret_val}" 0 PARENT_SCOPE)
|
|
|
|
endif(${feature})
|
|
|
|
endfunction()
|
2024-01-18 05:17:50 +08:00
|
|
|
|
|
|
|
# A function used to create autotools-style 'yes/no' definitions.
|
|
|
|
# If a variable is set, it 'yes' is returned. Otherwise, 'no' is
|
|
|
|
# returned.
|
|
|
|
#
|
|
|
|
# Also creates a version of the ret_val prepended with 'NC',
|
|
|
|
# when feature is true, which is used to generate netcdf_meta.h.
|
2024-01-18 05:47:16 +08:00
|
|
|
function(is_disabled feature ret_val)
|
|
|
|
if(${feature})
|
|
|
|
set(${ret_val} "no" PARENT_SCOPE)
|
|
|
|
else()
|
|
|
|
set(${ret_val} "yes" PARENT_SCOPE)
|
|
|
|
set("NC_${ret_val}" 1 PARENT_SCOPE)
|
|
|
|
endif(${feature})
|
|
|
|
endfunction()
|