mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
33d3d06971
CMake-based builds.
55 lines
1.9 KiB
CMake
55 lines
1.9 KiB
CMake
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
INCLUDE_DIRECTORIES(".")
|
|
|
|
SET(ncgen3_FILES main.c load.c escapes.c getfill.c init.c genlib.c ncgentab.c)
|
|
|
|
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
|
|
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
|
|
|
IF(NOT EXISTS ${netCDF_SOURCE_DIR}/ncgen3/ncgentab.c AND NOT EXISTS
|
|
${netCDF_SOURCE_DIR}/ncgen3/ncgentab.h)
|
|
ADD_CUSTOM_COMMAND(
|
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ncgentab.c ${CMAKE_CURRENT_SOURCE_DIR}/ncgentab.h
|
|
COMMAND bison -pncg -d ${netCDF_SOURCE_DIR}/ncgen3/ncgen.y
|
|
COMMAND mv ncgen.tab.c ${netCDF_SOURCE_DIR}/ncgen3/ncgentab.c
|
|
COMMAND mv ncgen.tab.h ${netCDF_SOURCE_DIR}/ncgen3/ncgentab.h
|
|
VERBATIM
|
|
)
|
|
ENDIF()
|
|
IF(USE_X_GETOPT)
|
|
SET(ncgen3_FILES ${ncgen3_FILES} XGetopt.c)
|
|
ENDIF()
|
|
|
|
ADD_EXECUTABLE(ncgen3 ${ncgen3_FILES})
|
|
|
|
TARGET_LINK_LIBRARIES(ncgen3 netcdf)
|
|
|
|
IF(ENABLE_TESTS)
|
|
SET(NCGEN3_TESTS run_tests)
|
|
IF(USE_NETCDF4)
|
|
SET(NCGEN3_TESTS ${NCGEN3_TESTS} run_nc4_tests)
|
|
ENDIF()
|
|
|
|
FOREACH(F ${NCGEN3_TESTS})
|
|
add_sh_test(ncgen3 ${F})
|
|
#ADD_TEST(ncgen3_${F} sh ${CMAKE_CURRENT_BINARY_DIR}/${F}.sh)
|
|
ENDFOREACH()
|
|
ENDIF()
|
|
INSTALL(TARGETS ncgen3 DESTINATION bin COMPONENT utilities)
|
|
|
|
SET(MAN_FILES ncgen3.1)
|
|
IF(NOT MSVC)
|
|
INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation)
|
|
ENDIF()
|
|
|
|
## Specify files to be distributed by 'make dist'
|
|
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
|
|
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt XGetopt.c Makefile.am ncgen.y ncgenyy.c ncgen.l c0.cdl ncgen3.1)
|
|
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
|
|
|
|
|
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc)
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
|
|