When creating the libnetcdf.settings file, CMake-based builds now include compiler and linker debug or release flags.

This commit is contained in:
Ward Fisher 2014-06-03 10:47:01 -06:00
parent 343c6fd6fd
commit 7ba232fb9d
2 changed files with 48 additions and 5 deletions

View File

@ -1368,12 +1368,53 @@ SET(host_os "${osrel}")
SET(abs_top_builddir "${CMAKE_BINARY_DIR}")
SET(CC_VERSION "${CMAKE_C_COMPILER}")
SET(CFLAGS "${CMAKE_C_FLAGS} ${CFLAGS}")
SET(CPPFLAGS "${CMAKE_CPP_FLAGS} ${CPPFLAGS}")
SET(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_LINKER_FLAGS} ${LDFLAGS}")
is_disabled(BUILD_SHARED_LIBRARY enable_static)
is_enabled(BUILD_SHARED_LIBRARY enable_shared)
# 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
is_disabled(BUILD_SHARED_LIBS enable_static)
is_enabled(BUILD_SHARED_LIBS enable_shared)
# Remove libnetcdf from NC_LIBS.
STRING(REPLACE "-lnetcdf " "" TMP_NC_LIBS "${NC_LIBS}")

View File

@ -9,6 +9,8 @@ This file contains a high-level description of this package's evolution. Release
### 4.3.3-rc1 Released TBD
* NetCDF creates a `libnetcdf.settings` file after configuration now, similar to those generated by `HDF4` and `HDF5`. It is installed into the same directory as the libraries. [NCF-303](https://bugtracking.unidata.ucar.edu/browse/NCF-303).
* Renamed `man4/` directory to `docs/` to make the purpose and contents clearer. See [man4 vs. docs #60](https://github.com/Unidata/netcdf-c/issues/60).
* Removed redundant variable `BUILD_DOCS` from the CMake configuration file. See the issue at github: [BUILD\_DOCS, ENABLE\_DOXYGEN #59](https://github.com/Unidata/netcdf-c/issues/59).