Updated CMakelists to remove debug, release subdirectories on Windows. Updating shell scripts to work with MSYS paths.

This commit is contained in:
Ward Fisher 2015-01-27 13:57:51 -07:00 committed by Ward Fisher
parent 0f17bc9792
commit fe1b96cdd9
6 changed files with 74 additions and 4 deletions

View File

@ -1117,10 +1117,21 @@ MACRO(print_conf_summary)
MESSAGE("")
ENDMACRO()
##
# Shell script Macro
##
# Determine if 'bash' is on the system.
##
FIND_PROGRAM(HAVE_BASH NAMES bash)
IF(HAVE_BASH)
MESSAGE(STATUS "Found bash: ${HAVE_BASH}")
ELSE()
MESSAGE(STATUS "Bash shell not found; disabling shell script tests.")
ENDIF()
MACRO(add_sh_test prefix F)
IF(NOT MSVC)
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")
ENDIF()
ENDMACRO()

View File

@ -24,7 +24,7 @@ TARGET_LINK_LIBRARIES(nc_test
# Some extra tests
SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta)
IF(NOT MSVC)
IF(NOT HAVE_BASH)
SET(TESTS ${TESTS} tst_atts3)
ENDIF()

View File

@ -30,6 +30,29 @@ ADD_EXECUTABLE(nccopy ${nccopy_FILES})
TARGET_LINK_LIBRARIES(ncdump netcdf ${ALL_TLL_LIBS})
TARGET_LINK_LIBRARIES(nccopy netcdf ${ALL_TLL_LIBS})
####
# We have to do a little tweaking
# to remove the Release/ and Debug/ directories
# in MSVC builds. This is required to get
# test scripts to work.
####
IF(MSVC)
SET_TARGET_PROPERTIES(ncdump PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncdump PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncdump PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(nccopy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
IF(ENABLE_TESTS)
ADD_EXECUTABLE(rewrite-scalar rewrite-scalar.c)
ADD_EXECUTABLE(bom bom.c)

View File

@ -33,6 +33,11 @@
# cc -g -o rewrite-scalar -I../libsrc rewrite-scalar.c -L../libsrc -lnetcdf
# echo "netcdf small {variables: byte t; data: t = 1;}" > small.cdl
set -e
if test "x$srcdir" = x ; then
srcdir=`pwd`
fi
echo ""
echo "*** testing length of classic file"
../ncgen/ncgen -b ${srcdir}/small.cdl

View File

@ -7,6 +7,21 @@ ENDIF()
ADD_EXECUTABLE(ncgen ${ncgen_FILES})
TARGET_LINK_LIBRARIES(ncgen netcdf ${ALL_TLL_LIBS})
####
# We have to do a little tweaking
# to remove the Release/ and Debug/ directories
# in MSVC builds. This is required to get
# test scripts to work.
####
IF(MSVC)
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
INSTALL(TARGETS ncgen DESTINATION bin COMPONENT utilities)
# Copy the input for the flex file (ncgen.l)

View File

@ -13,13 +13,29 @@ IF(NOT EXISTS ${netCDF_SOURCE_DIR}/ncgen3/ncgentab.c AND NOT EXISTS
VERBATIM
)
ENDIF()
IF(USE_X_GETOPT)
SET(ncgen3_FILES ${ncgen3_FILES} XGetopt.c)
ENDIF()
ADD_EXECUTABLE(ncgen3 ${ncgen3_FILES})
TARGET_LINK_LIBRARIES(ncgen3 netcdf ${ALL_TLL_LIBS})
####
# We have to do a little tweaking
# to remove the Release/ and Debug/ directories
# in MSVC builds. This is required to get
# test scripts to work.
####
IF(MSVC)
SET_TARGET_PROPERTIES(ncgen3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncgen3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncgen3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
IF(ENABLE_TESTS)
SET(NCGEN3_TESTS run_tests)