2012-08-04 06:24:29 +08:00
|
|
|
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)
|
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
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)
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2012-09-14 06:07:35 +08:00
|
|
|
IF(USE_X_GETOPT)
|
|
|
|
SET(ncgen3_FILES ${ncgen3_FILES} XGetopt.c)
|
|
|
|
ENDIF(
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
ADD_EXECUTABLE(ncgen3 ${ncgen3_FILES})
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(ncgen3 netcdf)
|
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
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_TEST(ncgen3_${F} sh ${CMAKE_CURRENT_BINARY_DIR}/${F}.sh)
|
|
|
|
ENDFOREACH()
|
|
|
|
ENDIF()
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
INSTALL(TARGETS ncgen3 DESTINATION bin)
|
2012-08-28 05:49:09 +08:00
|
|
|
|
|
|
|
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc)
|
|
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
|
|
|
|