vcpkg/ports/kealib/fix-cmake.patch

123 lines
5.2 KiB
Diff
Raw Normal View History

diff --git a/trunk/CMakeLists.txt b/trunk/CMakeLists.txt
index 464fb13..dc8e26f 100644
--- a/trunk/CMakeLists.txt
+++ b/trunk/CMakeLists.txt
@@ -8,6 +8,7 @@
# which were derived from those used by libLAS (http://liblas.org/)
#
# History
+# 2018/01/25 - updated by Hiroshi Miura
# 2012/07/02 - Created by Peter Bunting
#
###############################################################################
@@ -50,13 +51,10 @@ endif()
option (BUILD_SHARED_LIBS "Build with shared library" ON)
-set(HDF5_INCLUDE_DIR /usr/local/include CACHE PATH "Include PATH for HDF5")
-set(HDF5_LIB_PATH /usr/local/lib CACHE PATH "Library PATH for HDF5")
set(GDAL_INCLUDE_DIR "NOTFOUND" CACHE PATH "Include PATH for GDAL")
set(GDAL_LIB_PATH "NOTFOUND" CACHE PATH "Library PATH for GDAL")
-set(HDF5_STATIC_LIBS FALSE CACHE BOOL "On Windows, link against static HDF5 libs")
IF(GDAL_INCLUDE_DIR AND GDAL_LIB_PATH)
# by default, only build if paths are set
@@ -65,6 +63,8 @@ ELSE()
set(LIBKEA_WITH_GDAL FALSE CACHE BOOL "Choose if .kea GDAL driver should be built")
ENDIF()
+find_package(hdf5 COMPONENTS CXX HL REQUIRED)
+link_libraries(hdf5::hdf5_cpp-shared)
###############################################################################
###############################################################################
@@ -141,14 +141,7 @@ endif(APPLE)
# Check the required libraries are present
if (MSVC)
- if(HDF5_STATIC_LIBS)
- set(HDF5_LIBRARIES -LIBPATH:"${HDF5_LIB_PATH}" hdf5_cpp.lib hdf5.lib zlibstatic.lib)
- else()
- set(HDF5_LIBRARIES -LIBPATH:"${HDF5_LIB_PATH}" hdf5_cpp.lib hdf5.lib)
- set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB)
- endif()
else()
- set(HDF5_LIBRARIES "-L${HDF5_LIB_PATH} -lhdf5 -lhdf5_hl -lhdf5_cpp")
endif(MSVC)
if (MSVC)
@@ -160,21 +153,19 @@ endif(MSVC)
###############################################################################
# Setup configure file
-configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${PROJECT_HEADER_DIR}/libkea/kea-config.h" )
-configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${PROJECT_BINARY_DIR}/kea-config" )
+configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}/libkea/kea-config.h" )
+configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${CMAKE_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" )
###############################################################################
###############################################################################
# Documentation
-file(READ "doc/index.txt" README )
-file(WRITE "README.txt" "${README}")
###############################################################################
###############################################################################
# Build library
include_directories ("${PROJECT_HEADER_DIR}")
-include_directories(${HDF5_INCLUDE_DIR})
+include_directories ("${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}")
add_subdirectory ("${PROJECT_SOURCE_DIR}")
if (LIBKEA_WITH_GDAL)
add_subdirectory ("${PROJECT_GDAL_DIR}")
@@ -185,13 +176,11 @@ endif(LIBKEA_WITH_GDAL)
# Tests
enable_testing()
add_test(NAME test1 COMMAND src/test1)
-
###############################################################################
###############################################################################
# Installation
-
-install (FILES "${PROJECT_BINARY_DIR}/kea-config" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
###############################################################################
###############################################################################
diff --git a/trunk/src/CMakeLists.txt b/trunk/src/CMakeLists.txt
index 84456c4..b804e74 100644
--- a/trunk/src/CMakeLists.txt
+++ b/trunk/src/CMakeLists.txt
@@ -37,6 +37,7 @@ target_link_libraries(${LIBKEA_LIB_NAME} ${HDF5_LIBRARIES} )
###############################################################################
# Testing
+if(NOT DISABLE_TESTS)
# exe needs to be in 'src' otherwise it doesn't work
add_executable (test1 ${PROJECT_TEST_DIR}/test1.cpp)
target_link_libraries (test1 ${LIBKEA_LIB_NAME})
@@ -53,6 +54,7 @@ if(NOT WIN32)
# probably should match other compilers, but since this is a Conda
# specific hack I'm not going to bother
endif()
+endif()
###############################################################################
# Set target properties
@@ -67,6 +69,9 @@ PROPERTIES
###############################################################################
# Installation
-install (TARGETS ${LIBKEA_LIB_NAME} DESTINATION lib)
+install (TARGETS ${LIBKEA_LIB_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
install (FILES ${LIBKEA_H} DESTINATION include/libkea)
###############################################################################
\ No newline at end of file