mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
Merge pull request #2463 from magnusuMET/bugfix/read_only
Prevent cmake writing to source dir
This commit is contained in:
commit
717e022e80
@ -1983,22 +1983,18 @@ ENDIF()
|
||||
|
||||
MACRO(GEN_m4 filename)
|
||||
|
||||
set(dest "${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c")
|
||||
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.
|
||||
IF(NOT HAVE_M4)
|
||||
IF(NOT EXISTS ${dest})
|
||||
MESSAGE(FATAL_ERROR "m4 is required to generate ${dest}. Please install m4 so that it is on the PATH and try again.")
|
||||
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()
|
||||
ENDIF(NOT HAVE_M4)
|
||||
|
||||
IF(HAVE_M4)
|
||||
# If m4 is available, remove generated file if it exists.
|
||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${dest}
|
||||
COMMAND ${NC_M4}
|
||||
@ -2006,7 +2002,7 @@ set(dest "${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c")
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
ENDIF(HAVE_M4)
|
||||
ENDIF()
|
||||
ENDMACRO(GEN_m4)
|
||||
|
||||
# Binary tests, but ones which depend on value of 'TEMP_LARGE' being defined.
|
||||
|
@ -20,20 +20,18 @@ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_filter_avail.c "${ASOURCE}")
|
||||
FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/../nc_test4/tst_specific_filters.sh SPSOURCE)
|
||||
STRING(PREPEND SPSOURCE "#!/bin/bash\n")
|
||||
STRING(PREPEND SPSOURCE "TESTNCZARR=1\n")
|
||||
FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/run_specific_filters.1 "${SPSOURCE}")
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/run_specific_filters.1 ${CMAKE_CURRENT_SOURCE_DIR}/run_specific_filters.sh @ONLY NEWLINE_STYLE LF)
|
||||
FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/run_specific_filters.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/run_specific_filters.1)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/run_specific_filters.sh)
|
||||
# Replace with FILE(CONFIGURE) when cmake 3.18 is in common use
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/run_specific_filters.1 "${SPSOURCE}")
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/run_specific_filters.1 ${CMAKE_CURRENT_BINARY_DIR}/run_specific_filters.sh FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE @ONLY NEWLINE_STYLE LF)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/run_specific_filters.1)
|
||||
|
||||
FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/../nc_test4/tst_unknown.sh SPSOURCE)
|
||||
STRING(PREPEND SPSOURCE "#!/bin/bash\n")
|
||||
STRING(PREPEND SPSOURCE "TESTNCZARR=1\n")
|
||||
FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/run_unknown.1 "${SPSOURCE}")
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/run_unknown.1 ${CMAKE_CURRENT_SOURCE_DIR}/run_unknown.sh @ONLY NEWLINE_STYLE LF)
|
||||
FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/run_unknown.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/run_unknown.1)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/run_unknown.sh)
|
||||
# Replace with FILE(CONFIGURE) when cmake 3.18 is in common use
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/run_unknown.1 "${SPSOURCE}")
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/run_unknown.1 ${CMAKE_CURRENT_BINARY_DIR}/run_unknown.sh FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE @ONLY NEWLINE_STYLE LF)
|
||||
FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/run_unknown.1)
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ref*.cdl
|
||||
|
Loading…
Reference in New Issue
Block a user