Debian Codegraph @

cextern/cfitsio/cmake/portfile.cmake

raw
1 # vcpkg-cfitsio provides CMake targets:
2 #
3 # Basic usage is:
4 #
5 # find_package(cfitsio REQUIRED)
6 # target_link_libraries(${PROJECT_NAME} PRIVATE CFITSIO::cfitsio)
7 #
8 # Notes:
9 # This is built as a static library. The Windows build does not use pthreads, so you will need to provide your own locking around use of the library.
10
11 vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
12
13 vcpkg_from_github(
14 OUT_SOURCE_PATH SOURCE_PATH
15 REPO HEASARC/cfitsio
16 REF cfitsio-${VERSION}
17 SHA512 b33c27070b311a831c2a40780549966ef3cc36b7052efd2fe8e44ce07061d9ed8297a822153cc6365469824aaec61c307f6d37adeae79e8b51ca620876b4733a
18 HEAD_REF main
19 )
20
21 set (options
22 "-DUSE_BZIP2=ON "
23 "-DUSE_CURL=OFF "
24 "-DTESTS=OFF "
25 "-DUTILS=OFF"
26 )
27 if(VCPKG_TARGET_IS_WINDOWS)
28 set (options "${options}; -DUSE_PTHREADS=OFF")
29 else()
30 set (options "${options}; -DUSE_PTHREADS=ON")
31 endif()
32
33 message ("****************************************************************")
34 message ("Setting build options: " ${options})
35 message ("****************************************************************")
36
37 vcpkg_cmake_configure(
38 SOURCE_PATH "${SOURCE_PATH}"
39 OPTIONS ${options}
40 )
41
42 vcpkg_cmake_install()
43
44 vcpkg_copy_pdbs()
45
46 vcpkg_fixup_pkgconfig()
47 #
48 # cfitsio puts its cmake files into /lib/cmake/cfitsio, but vcpkg doesn't want
49 # them there, causing error messages:
50 # 1> [CMake] D:\Github\DSS\./vcpkg_overlay_ports\cfitsio\portfile.cmake: warning: This port installs the following CMake files in places CMake files are not expected. CMake files should be installed in ${CURRENT_PACKAGES_DIR}/share/${PORT}. To suppress this message, add set(VCPKG_POLICY_SKIP_MISPLACED_CMAKE_FILES_CHECK enabled)
51 # 1> [CMake] D:\Github\DSS\build\vcpkg_installed\vcpkg\pkgs\cfitsio_x64-windows-static-md: note: the files are relative to ${CURRENT_PACKAGES_DIR} here
52 # 1> [CMake] note: lib/cmake/cfitsio/cfitsioConfig.cmake
53 # 1> [CMake] note: lib/cmake/cfitsio/cfitsioConfigVersion.cmake
54 # 1> [CMake] note: lib/cmake/cfitsio/cfitsioTargets-release.cmake
55 # 1> [CMake] note: lib/cmake/cfitsio/cfitsioTargets.cmake
56 # 1> [CMake] note: debug/lib/cmake/cfitsio/cfitsioConfig.cmake
57 # 1> [CMake] note: debug/lib/cmake/cfitsio/cfitsioConfigVersion.cmake
58 # 1> [CMake] note: debug/lib/cmake/cfitsio/cfitsioTargets-debug.cmsake
59 # 1> [CMake] note: debug/lib/cmake/cfitsio/cfitsioTargets.cmake
60 #
61 # So tell vcpkg to fix this for us.
62 #
63 vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
64
65 file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
66
67 file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
68 vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/licenses/License.txt")