From 4b1684117438b1b934669fd85f86f257b4698309 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 20 Oct 2015 16:09:08 -0500 Subject: [svn-r28146] Correct define vs variable usage --- config/cmake/HDF518_Examples.cmake.in | 26 +++++++++++++------------- config/cmake/scripts/CTestScript.cmake | 11 +++++++++-- config/cmake/scripts/HDF518config.cmake | 24 ++++++++++++------------ 3 files changed, 34 insertions(+), 27 deletions(-) diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index c825f48..fee03b1 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -35,7 +35,7 @@ endif() if(NOT DEFINED CTEST_SOURCE_NAME) set(CTEST_SOURCE_NAME "HDF5Examples") endif() -if(NOT DEFINED STATICLIBRARIES) +if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") endif() @@ -48,17 +48,17 @@ endif() # Adjust the following SET Commands as needed ############################################################################################################### if(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else(WIN32) - if(STATICLIBRARIES) + if(${STATICLIBRARIES}) set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - endif(STATICLIBRARIES) + endif() set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) @@ -83,11 +83,11 @@ if(APPLE) if(NOT NO_MAC_FORTRAN) # Shared fortran is not supported, build static set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else(NOT NO_MAC_FORTRAN) + else() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif(NOT NO_MAC_FORTRAN) + endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif(APPLE) +endif() #----------------------------------------------------------------------------- set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") @@ -107,7 +107,7 @@ if(CTEST_USE_TAR_SOURCE) message(STATUS "extracting... [error-(${rv}) clean up]") file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif(NOT rv EQUAL 0) + endif() endif(CTEST_USE_TAR_SOURCE) #----------------------------------------------------------------------------- @@ -116,9 +116,9 @@ endif(CTEST_USE_TAR_SOURCE) set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) -else (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +else () file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -endif (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +endif () # Use multiple CPU cores to build include(ProcessorCount) @@ -126,7 +126,7 @@ ProcessorCount(N) if(NOT N EQUAL 0) if(NOT WIN32) set(CTEST_BUILD_FLAGS -j${N}) - endif(NOT WIN32) + endif() set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) endif() set (CTEST_CONFIGURE_COMMAND @@ -148,7 +148,7 @@ ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) if(res GREATER 0) message (FATAL_ERROR "tests FAILED") -endif(res GREATER 0) +endif() #----------------------------------------------------------------------------- ############################################################################################################## message(STATUS "DONE") \ No newline at end of file diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 9d0953e..abe252e 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -56,6 +56,13 @@ if(APPLE) set(ENV{CC} "${XCODE_CC}") set(ENV{CXX} "${XCODE_CXX}") + if(NOT NO_MAC_FORTRAN) + # Shared fortran is not supported, build static + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else(NOT NO_MAC_FORTRAN) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") + endif(NOT NO_MAC_FORTRAN) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") endif(APPLE) @@ -66,10 +73,10 @@ if(CTEST_USE_TAR_SOURCE) ## Uncompress source if tar file provided ## -------------------------- if(WIN32) - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_USE_TAR_SOURCE}.zip]") + message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) else() - message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") + message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]") execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) endif() diff --git a/config/cmake/scripts/HDF518config.cmake b/config/cmake/scripts/HDF518config.cmake index eaa0b7b..5d10a98 100755 --- a/config/cmake/scripts/HDF518config.cmake +++ b/config/cmake/scripts/HDF518config.cmake @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # INSTALLDIR - root folder where hdf5 is installed # CTEST_BUILD_CONFIGURATION - Release, Debug, etc # CTEST_SOURCE_NAME - source folder -# STATICLIBRARIES - Build/use static libraries +# STATIC_LIBRARIES - Build/use static libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## @@ -50,15 +50,15 @@ if(NOT DEFINED BUILD_GENERATOR) message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2013, VS201364, VS2012, or VS201264") else() if(${BUILD_GENERATOR} STREQUAL "Unix") - set(CMAKE_GENERATOR "Unix Makefiles") + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") elseif(${BUILD_GENERATOR} STREQUAL "VS2013") - set(CMAKE_GENERATOR "Visual Studio 12 2013") + set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013") elseif(${BUILD_GENERATOR} STREQUAL "VS201364") - set(CMAKE_GENERATOR "Visual Studio 12 2013 Win64") + set(CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64") elseif(${BUILD_GENERATOR} STREQUAL "VS2012") - set(CMAKE_GENERATOR "Visual Studio 11 2012") + set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012") elseif(${BUILD_GENERATOR} STREQUAL "VS201264") - set(CMAKE_GENERATOR "Visual Studio 11 2012 Win64") + set(CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64") else() message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2013, VS201364, VS2012, or VS201264") endif() @@ -66,9 +66,9 @@ endif() if(NOT DEFINED INSTALLDIR) if(WIN32) - set(INSTALLDIR "/usr/local/myhdf5") - else() set(INSTALLDIR "C:\\Program\ Files\\myhdf5") + else() + set(INSTALLDIR "/usr/local/myhdf5") endif() endif() if(NOT DEFINED CTEST_BUILD_CONFIGURATION) @@ -155,12 +155,12 @@ set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8_16") #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ################################################################### -if(STATICLIBRARIES) +if(${STATICLIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") ######### Following describes computer ############ ## following is optional to describe build ## set(SITE_BUILDNAME_SUFFIX "STATIC") -endif(STATICLIBRARIES) +endif() ################################################################### ### uncomment/comment and change the following lines for other configuration options @@ -178,11 +178,11 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### fortran #### -if(FORTRANLIBRARIES) +if(${FORTRANLIBRARIES}) set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") -endif(FORTRANLIBRARIES) +endif() ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") -- cgit v0.12