Skip to content

Commit

Permalink
Manual merge of pull request #64 contributed by nschloe. Assorted CMa…
Browse files Browse the repository at this point in the history
…ke improvements.
  • Loading branch information
Ward Fisher committed Jun 11, 2014
1 parent 77b7932 commit 7f812b3
Show file tree
Hide file tree
Showing 33 changed files with 48 additions and 217 deletions.
78 changes: 19 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
##################################

#Minimum required CMake Version
cmake_minimum_required(VERSION 2.8.8)
cmake_minimum_required(VERSION 2.8.9)

#Project Name
project(netCDF C)
Expand Down Expand Up @@ -136,14 +136,11 @@ INCLUDE(GenerateExportHeader)
################################

# Default building shared libraries.
# BUILD_SHARED_LIBS is provided by/used by
# CMake directly.
OPTION(BUILD_SHARED_LIBS "Configure netCDF as a shared library." ON)
SET(LIB_TYPE STATIC)
IF(BUILD_SHARED_LIBS)
SET(LIB_TYPE SHARED)
IF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fPIC")
ENDIF()
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()

# Set some default linux gcc & apple compiler options for
Expand Down Expand Up @@ -465,8 +462,6 @@ ENDIF()
# Option checks
################################

SET(CMAKE_INCLUDE_CURRENT_DIR ON)

# HDF5 cache variables.
SET(DEFAULT_CHUNK_SIZE 4194304 CACHE STRING "Default Chunk Cache Size.")
SET(DEFAULT_CHUNKS_IN_CACHE 10 CACHE STRING "Default number of chunks in cache.")
Expand Down Expand Up @@ -747,23 +742,27 @@ IF(ENABLE_DAP)
ADD_DEFINITIONS(-DCURL_STATICLIB=1)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})

# Check to see if CURLOPT_USERNAME is defined. It is present starting version 7.19.1
# Check to see if CURLOPT_USERNAME is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME)

# Check to see if CURLOPT_PASSWORD is defined. It is present starting version 7.19.1
CHECK_C_SOURCE_COMPILES("
# Check to see if CURLOPT_PASSWORD is defined.
# It is present starting version 7.19.1.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD)

# Check to see if CURLOPT_KEYPASSWD is defined. It is present starting version 7.16.4
CHECK_C_SOURCE_COMPILES("
# Check to see if CURLOPT_KEYPASSWD is defined.
# It is present starting version 7.16.4.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD)

# Check to see if CURLINFO_RESPONSE_CODE is defined. It showed up in curl 7.10.7
CHECK_C_SOURCE_COMPILES("
# Check to see if CURLINFO_RESPONSE_CODE is defined.
# It showed up in curl 7.10.7.
CHECK_C_SOURCE_COMPILES("
#include <curl/curl.h>
int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
ENDIF()
Expand Down Expand Up @@ -1369,49 +1368,10 @@ SET(abs_top_builddir "${CMAKE_BINARY_DIR}")

SET(CC_VERSION "${CMAKE_C_COMPILER}")


# Build CFLAGS from debug and release flags as needed.
SET(CFLAGS_TMP "${CMAKE_C_FLAGS}")

IF("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
SET(CFLAGS_TMP "${CFLAGS_TMP} ${CMAKE_C_FLAGS_DEBUG}")
ENDIF()

IF("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
SET(CFLAGS_TMP "${CFLAGS_TMP} ${CMAKE_C_FLAGS_RELEASE}")
ENDIF()

SET(CFLAGS "${CFLAGS_TMP} ${CFLAGS}")
# End CFLAGS

# Build CPPFLAGS from debug and release flags as needed.
SET(CPPFLAGS_TMP "${CMAKE_CPP_FLAGS}")

IF("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
SET(CPPFLAGS_TMP "${CPPFLAGS_TMP} ${CMAKE_CPP_FLAGS_DEBUG}")
ENDIF()

IF("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
SET(CPPFLAGS_TMP "${CPPFLAGS_TMP} ${CMAKE_CPP_FLAGS_RELEASE}")
ENDIF()

SET(CPPFLAGS "${CPPFLAGS_TMP} ${CPPFLAGS}")
# End CPPFLAGS

# Build LDFLAGS from debug and release flags as needed.
SET(LDFLAGS_TMP "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_LINKER_FLAGS}")

IF("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
SET(LDFLAGS_TMP "${LDFLAGS_TMP} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CMAKE_LINKER_FLAGS_DEBUG}")
ENDIF()

IF("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
SET(LDFLAGS_TMP "${LDFLAGS_TMP} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${CMAKE_LINKER_FLAGS_RELEASE}")
ENDIF()

SET(LDFLAGS "${LDFLAGS_TMP} ${LDFLAGS}")
# End LDFLAGS

# Build *FLAGS for libnetcdf.settings.
SET(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}")

is_disabled(BUILD_SHARED_LIBS enable_static)
is_enabled(BUILD_SHARED_LIBS enable_shared)
Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This file contains a high-level description of this package's evolution. Release

### 4.3.3-rc1 Released TBD

* Bumped minimum CMake version to `2.8.9` from `2.8.8` as part of a larger pull request contributed by Nico Schlömer. [Pull Request #64](https://github.com/Unidata/netcdf-c/pull/64)

* Replaced the `NetCDF Library Architecture` image with an updated version from the 2012 NetCDF Workshop slides.

* Fix HDF4 files to support chunking.
Expand Down
27 changes: 11 additions & 16 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")


#####
# Build doxygen documentation, if need be.
#####
IF(ENABLE_DOXYGEN)
# The following is redundant but does not hurt anything.
# The following is redundant but does not hurt anything.

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.html ${CMAKE_CURRENT_SOURCE_DIR}/images ${CMAKE_CURRENT_SOURCE_DIR}/*.doc ${CMAKE_CURRENT_SOURCE_DIR}/*.xml ${CMAKE_CURRENT_SOURCE_DIR}/*.m4 ${CMAKE_CURRENT_SOURCE_DIR}/*.texi)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)

# Set abs_top_srcdir to work with the autotools
# doxyfile template.
SET(abs_top_srcdir ${CMAKE_SOURCE_DIR})
Expand All @@ -23,7 +18,7 @@ IF(ENABLE_DOXYGEN)
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.guide @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.tutorial.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.tutorial @ONLY)

# We need to loop through twice. First to generate tags.
ADD_CUSTOM_TARGET(all_doc_tags ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
Expand All @@ -40,7 +35,7 @@ IF(ENABLE_DOXYGEN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Tutorial Tags" VERBATIM
)

# Second, generate documentation that uses the tags.
ADD_CUSTOM_TARGET(doc_all ALL
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
Expand All @@ -58,19 +53,19 @@ IF(ENABLE_DOXYGEN)
COMMENT "Generating Tutorial Tags" VERBATIM
)

# Copy the image files used by markdown documentation
# Copy the image files used by markdown documentation
# manually.
FILE(GLOB IMG_FILES ${CMAKE_CURRENT_BINARY_DIR}/images/*.jpg
FILE(GLOB IMG_FILES ${CMAKE_CURRENT_BINARY_DIR}/images/*.jpg
${CMAKE_CURRENT_BINARY_DIR}/images/*.png)
FILE(COPY ${IMG_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/html)

FILE(COPY ${IMG_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/html)

INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT documentation)

ENDIF(ENABLE_DOXYGEN)

SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am netcdf.m4 DoxygenLayout.xml Doxyfile.in Doxyfile.guide.in footer.html mainpage.dox tutorial.dox install.dox dispatch.dox guide.dox types.dox notes.dox cdl.dox architecture.dox internal.dox install-fortran.dox Doxyfile.in.cmake windows-binaries.md building-with-cmake.md)

ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
6 changes: 1 addition & 5 deletions examples/C/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

SET(exam_C_tests simple_xy_wr simple_xy_rd sfc_pres_temp_wr sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd)
SET(exam_C_tests_source "")
FOREACH(F ${exam_C_tests})
FOREACH(F ${exam_C_tests})
set(exam_C_tests_source ${exam_C_test_source} ${F}.c)
ENDFOREACH()

Expand Down
5 changes: 0 additions & 5 deletions examples/CDL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")


SET(CDL_EXAMPLE_TESTS create_sample_files do_comps)

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
Expand Down
4 changes: 0 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

ADD_SUBDIRECTORY(C)

IF(BUILD_UTILITIES)
Expand Down
4 changes: 0 additions & 4 deletions h5_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

SET(H5TESTS tst_h_files tst_h_files2 tst_h_files4 tst_h_atts tst_h_atts3 tst_h_atts4 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl tst_h_opaques tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints tst_h_dimscales tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 tst_h_enums tst_h_dimscales4)

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.nc)
Expand Down
4 changes: 0 additions & 4 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} Makefile.am CMakeLists.txt)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
6 changes: 1 addition & 5 deletions libdap2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

SET(dap2_SOURCES constraints.c dapcvt.c dapalign.c dapodom.c daputil.c ncdaperr.c cdf.c cache.c dapdump.c dapdebug.c dapattr.c ncd2dispatch.c getvara.c dceconstraints.c dcetab.c dceparse.c dcelex.c)

add_library(dap2 OBJECT ${dap2_SOURCES})
add_library(dap2 OBJECT ${dap2_SOURCES})

###
# Options related to the man page generation.
Expand Down
4 changes: 0 additions & 4 deletions libdispatch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

SET(libdispatch_SOURCES dparallel.c dcopy.c dfile.c ddim.c datt.c dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c dvarinq.c ddispatch.c nclog.c dstring.c dutf8proc.c ncuri.c nclist.c ncbytes.c nchashmap.c nctime.c dsubstrate.c nc.c nclistmgr.c)

IF(USE_NETCDF4)
Expand Down
6 changes: 1 addition & 5 deletions liblib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

SET(liblib_LIBS dispatch netcdf3)

#####
Expand All @@ -28,7 +24,7 @@ FOREACH(LIBS ${liblib_LIBS})
SET(LARGS ${LARGS} $<TARGET_OBJECTS:${LIBS}>)
ENDFOREACH()

ADD_LIBRARY(netcdf ${LIB_TYPE} stub.c ${LARGS} )
ADD_LIBRARY(netcdf stub.c ${LARGS} )
IF(MOD_NETCDF_NAME)
SET_TARGET_PROPERTIES(netcdf PROPERTIES LIBRARY_OUTPUT_NAME ${NETCDF_LIB_NAME})
SET_TARGET_PROPERTIES(netcdf PROPERTIES ARCHIVE_OUTPUT_NAME ${NETCDF_LIB_NAME})
Expand Down
5 changes: 0 additions & 5 deletions libsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
## This is a CMake file, part of Unidata's netCDF package.
# Copyright 2012-2013, see the COPYRIGHT file for more information.

SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")


# Process these files with m4.
SET(m4_SOURCES attr ncx putget t_ncxx)
foreach (f ${m4_SOURCES})
Expand Down
4 changes: 0 additions & 4 deletions libsrc4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

# Process these files with m4.

SET(libsrc4_SOURCES nc4dispatch.c nc4attr.c nc4dim.c nc4file.c nc4grp.c nc4type.c nc4var.c ncfunc.c nc4internal.c nc4hdf.c)
Expand Down
4 changes: 0 additions & 4 deletions libsrc5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

SET(libsrc5_SOURCES nc5dispatch.c)

add_library(netcdf5 OBJECT ${libsrc5_SOURCES})
Expand Down
4 changes: 0 additions & 4 deletions nc_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")
SET (nc_test_m4_SOURCES test_get test_put)
FOREACH (F ${nc_test_m4_SOURCES})
GEN_m4(${F})
ENDFOREACH()


SET (nc_test_SRC nc_test.c error.c test_get.c test_put.c test_read.c test_write.c util.c)
ADD_EXECUTABLE(nc_test ${nc_test_SRC})
TARGET_LINK_LIBRARIES(nc_test netcdf)
Expand Down
7 changes: 2 additions & 5 deletions nc_test4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")
# Some extra tests
SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars
tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps tst_grps2
Expand Down Expand Up @@ -71,13 +68,13 @@ IF(USE_HDF4_FILE_TESTS)
ENDIF()

IF(TEST_PARALLEL)
build_bin_test(tst_mpi_parallel)
build_bin_test(tst_mpi_parallel)
build_bin_test(tst_parallel)
build_bin_test(tst_parallel3)
build_bin_test(tst_parallel4)
build_bin_test(tst_nc4perf)
add_sh_test(nc_test4 run_par_test)
ENDIF()
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)
Expand Down
5 changes: 0 additions & 5 deletions ncdap_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")


SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})

remove_definitions(-DDLL_EXPORT)
Expand Down
6 changes: 1 addition & 5 deletions ncdap_test/expected3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)

FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
6 changes: 1 addition & 5 deletions ncdap_test/expected4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)

FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
6 changes: 1 addition & 5 deletions ncdap_test/expectremote3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

INCLUDE_DIRECTORIES(".")

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)

FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
Loading

0 comments on commit 7f812b3

Please sign in to comment.