Skip to content

Commit

Permalink
Additional CMake support, CPack support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ward Fisher committed Aug 29, 2012
1 parent 31cfdd5 commit 9e8cfcf
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 22 deletions.
51 changes: 34 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 2.8.8)
#Project Name
project(NetCDF C)
SET(NetCDF_VERSION 4.2.1)
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
SET(CPACK_PACKAGE_VERSION "4.3")
ENABLE_TESTING()
INCLUDE(CTest)

Expand All @@ -24,6 +22,7 @@ ADD_DEFINITIONS()

### Verbose make, for debugging.
#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

#Add custom CMake Module
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
Expand All @@ -38,13 +37,8 @@ INCLUDE (${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(APPLE)
SET(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_GENERATOR "DragNDrop")
SET(CPACK_BINARY_DRAGNDROP ON CACHE BOOL "")
SET(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "")
ENDIF()
INCLUDE (${CMAKE_ROOT}/Modules/GetPrerequisites.cmake)


#####
# A basic script used to convert m4 files
Expand Down Expand Up @@ -446,6 +440,7 @@ INCLUDE_DIRECTORIES(${NetCDF_SOURCE_DIR}/oc2)
#add_subdirectory(h5_test)
#add_subdirectory(man4)
#add_subdirectory(man4/images)
add_subdirectory("include")
add_subdirectory(libdispatch)
add_subdirectory(libsrc)

Expand All @@ -463,11 +458,11 @@ IF (BUILD_CDMREMOTE)
ENDIF()

add_subdirectory(liblib)
MESSAGE(STATUS "Linking with: ${ALL_TLL_LIBS}")

# Enable Utilities.

IF (BUILD_UTILITIES)
MESSAGE(STATUS "Linking with: ${ALL_TLL_LIBS}")
ADD_SUBDIRECTORY(ncgen)
ADD_SUBDIRECTORY(ncgen3)
ADD_SUBDIRECTORY(ncdump)
Expand Down Expand Up @@ -502,10 +497,13 @@ ENDIF()
#####
INSTALL(FILES ${NetCDF_BINARY_DIR}/config.h
DESTINATION include)
INSTALL(FILES ${NetCDF_SOURCE_DIR}/include/netcdf.h
DESTINATION include)

INSTALL(FILES ${ALL_TLL_LIBS} DESTINATION deps)
#INSTALL(FILES ${NetCDF_SOURCE_DIR}/include/netcdf.h
# DESTINATION include)
INSTALL(DIRECTORY include DESTINATION include)
IF(ENABLE_DOXYGEN)
INSTALL(DIRECTORY man4 DESTINATION man4)
ENDIF()
#INSTALL(FILES ${ALL_TLL_LIBS} DESTINATION deps)

# Subdirectory CMakeLists.txt files should specify their own
# 'install' files.
Expand All @@ -516,11 +514,16 @@ CONFIGURE_FILE(
${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake
@ONLY
)
#INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake)

#####
# Various options for CPACK
#####

##
# Declare exclusions list used when building a source file.
# NOTE!! This list uses regular expressions, NOT wildcards!!
#
#####
# NOTE!! This list uses regular expressions, NOT wildcards!!
##
SET (CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}"
"Makefile\\\\.in$"
"${CMAKE_BINARY_DIR}/*"
Expand All @@ -529,6 +532,20 @@ SET (CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}"
"my.*sh"
".*~"
)

IF(APPLE)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT
${CMAKE_CURRENT_BINARY_DIR}/COPYRIGHT.txt
@ONLY
)
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/COPYRIGHT.txt")

SET(CPACK_PACKAGE_VERSION "4.3")
SET(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_GENERATOR "PackageMaker" "STGZ" "TBZ2" "TGZ" "ZIP")
ENDIF()


MESSAGE(STATUS "CPACK_SOURCE_IGNORE_FILES: ${CPACK_SOURCE_IGNORE_FILES}")
# CPack inclusion must come last.
INCLUDE(CPack)
Expand Down
4 changes: 2 additions & 2 deletions FixBundle.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ INCLUDE(BundleUtilities)

# Set bundle to the full path name of the executable

SET (BUNDLE "${CMAKE_INSTALL_PREFIX}/ncdump@CMAKE_EXECUTABLE_SUFFIX@"
SET (BUNDLE "${CMAKE_INSTALL_PREFIX}/ncdump@CMAKE_EXECUTABLE_SUFFIX@")

SET (OTHER_LIBS "")

SET (DIRS "@LIBRARY_OUTPUT_PATH@")

fixup_bundle("${BUNDLE}" "${OTHER_LIBS}" "${DIRS}")
fixup_bundle("${BUNDLE}" "${OTHER_LIBS}" "${DIRS}")
3 changes: 3 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")
3 changes: 2 additions & 1 deletion liblib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ IF(ENABLE_PNETCDF AND PNETCDF)
#TARGET_LINK_LIBRARIES(netcdf ${PNETCDF})
ENDIF()
TARGET_LINK_LIBRARIES(netcdf ${TLL_LIBS})
INSTALL(TARGETS netcdf DESTINATION lib)
INSTALL(TARGETS netcdf DESTINATION lib EXPORT netcdf-targets)
INSTALL(EXPORT netcdf-targets DESTINATION ".")
#include(CPack)
SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE)
4 changes: 2 additions & 2 deletions nctest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ ADD_EXECUTABLE(tst_rename tst_rename.c)
TARGET_LINK_LIBRARIES(nctest netcdf)
TARGET_LINK_LIBRARIES(tst_rename netcdf)

INSTALL(TARGETS nctest DESTINATION bin)
INSTALL(TARGETS tst_rename DESTINATION bin)
#INSTALL(TARGETS nctest DESTINATION bin)
#INSTALL(TARGETS tst_rename DESTINATION bin)
## Tests
#ADD_TEST(run_tests.sh ${CMAKE_SOURCE_PATH}/run_tests.sh)

Expand Down

0 comments on commit 9e8cfcf

Please sign in to comment.