Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

followup to #3333: libdap configuration #3355

Merged
merged 1 commit into from Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions CMakeLists.txt
Expand Up @@ -484,20 +484,19 @@ ENDIF()

# Find the libdap package so that Aspect can connect to the OPeNDAP servers
# Author: Kodi Neumiller
# Added: 10/16/18
SET(ASPECT_WITH_LIBDAP OFF CACHE BOOL "Check if the user wants to compile ASPECT with the libdap libraries.")
MESSAGE("\nASPECT_WITH_LIBDAP = '${ASPECT_WITH_LIBDAP}'")
MESSAGE(STATUS "Using ASPECT_WITH_LIBDAP = '${ASPECT_WITH_LIBDAP}'")
IF(ASPECT_WITH_LIBDAP)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}/cmake/modules")
FIND_PACKAGE(LIBDAP)
IF(${LIBDAP_FOUND})
INCLUDE_DIRECTORIES(${LIBDAP_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${TARGET} ${LIBDAP_LIBRARIES} ${LIBXML2_LIBRARIES} ${CURL_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET} ${LIBDAP_LIBRARIES})
FOREACH(_source_file ${TARGET_SRC})
SET_PROPERTY(SOURCE ${_source_file}
APPEND PROPERTY COMPILE_DEFINITIONS HAVE_LIBDAP=1)
ENDFOREACH()
MESSAGE(STATUS "-- LIBDAP found at ${LIBDAP_LIBRARIES}\n")
MESSAGE(STATUS "LIBDAP found at ${LIBDAP_LIBRARY}\n")
ELSE()
MESSAGE(FATAL_ERROR "LIBDAP not found. Disable ASPECT_WITH_LIBDAP or specify a hint to your installation directory with LIBDAP_DIR.")
ENDIF()
Expand Down
38 changes: 26 additions & 12 deletions cmake/modules/FindLIBDAP.cmake
@@ -1,8 +1,20 @@
## ---------------------------------------------------------------------
##
## Copyright (C) 2018 by Kodi Neumiller, James Gallagher
##
## ---------------------------------------------------------------------
# Copyright (C) 2020 by the authors of the ASPECT code.
#
# This file is part of ASPECT.
#
# ASPECT is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# ASPECT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ASPECT; see the file LICENSE. If not see
# <http://www.gnu.org/licenses/>.

# Try to find the Libdap library

Expand Down Expand Up @@ -43,6 +55,7 @@ FIND_PROGRAM(LIBDAP_CONFIG_EXECUTABLE

#Lookup and add the CURL and libxml2 libraries
IF(LIBDAP_CONFIG_EXECUTABLE)
MESSAGE(STATUS "probing ${LIBDAP_CONFIG_EXECUTABLE} for libdap configuration:")
EXECUTE_PROCESS(COMMAND ${LIBDAP_CONFIG_EXECUTABLE} --libs
OUTPUT_VARIABLE _libs
ERROR_QUIET
Expand Down Expand Up @@ -70,7 +83,8 @@ IF(LIBDAP_CONFIG_EXECUTABLE)
STRING(REPLACE " " ";" _flags "${_flags}")
FOREACH(_flag ${_flags})
IF (${_flag} MATCHES "^-I")
SET(LIBDAP_INCLUDE_DIR ${LIBDAP_INCLUDE_DIR} ${_path})
STRING(SUBSTRING ${_flag} 2 -1 _path)
SET(LIBDAP_INCLUDE_DIR ${LIBDAP_INCLUDE_DIR} ${_path})
ENDIF()
ENDFOREACH()
ENDIF()
Expand All @@ -84,15 +98,15 @@ FIND_LIBRARY(LIBXML2_LIBRARIES
HINTS ${LIBXML2_PATH}
)

MESSAGE(STATUS "-- LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}")
MESSAGE(STATUS "-- LIBCURL_LIBRARIES: ${LIBCURL_LIBRARIES}")
#MESSAGE(STATUS "-- LIBDAP_INCLUDE_DIR: ${LIBDAP_INCLUDE_DIR}")
MESSAGE(STATUS " LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}")
MESSAGE(STATUS " LIBCURL_LIBRARIES: ${LIBCURL_LIBRARIES}")
MESSAGE(STATUS " LIBDAP_INCLUDE_DIRS: ${LIBDAP_INCLUDE_DIR}")


IF(LIBDAP_LIBRARY AND LIBDAP_CLIENT_LIBRARY AND LIBDAP_CONFIG_EXECUTABLE)
IF(LIBDAP_LIBRARY AND LIBDAP_CLIENT_LIBRARY AND LIBDAP_CONFIG_EXECUTABLE AND LIBCURL_LIBRARIES AND LIBXML2_LIBRARIES)
SET(LIBDAP_FOUND TRUE)
SET(LIBDAP_INCLUDE_DIRS ${LIBDAP_INCLUDE_DIR})
SET(LIBDAP_LIBRARY ${LIBDAP_LIBRARY})
SET(LIBDAP_LIBRARIES ${LIBDAP_CLIENT_LIBRARY} ${LIBDAP_LIBRARY} ${LIBXML2_LIBRARIES} ${LIBCURL_LIBRARIES})
ELSE()
SET(LIBDAP_FOUND FALSE)
ENDIF()
ENDIF()
5 changes: 2 additions & 3 deletions doc/modules/changes/20200116_kneumiller
@@ -1,4 +1,3 @@
Added: A module in the cmake directory that looks for, and adds the path of, the libdap libraries.
Added: Link to libdap if ASPECT_WITH_LIBDAP is specified at configure time.
<br>
(Kodi Neumiller, 2020/01/16)
<br>
(Kodi Neumiller and Timo Heister, 2020/01/16)