Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,103
    • Issues 4,103
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #21637
Closed
Open
Issue created Dec 26, 2020 by Kris Thielemans@krthieContributor

FindHDF5 INTERFACE_LINK_LIBRARIES failure if both debug and release libraries are found

I've built HDF5 myself and installed both Debug and RelWithDebInfo. Now I have problem when trying to use find_package(HDF5):

4>CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/FindHDF5.cmake:993 (set_target_properties):
4>  Property INTERFACE_LINK_LIBRARIES may not contain link-type keyword
4>  "optimized".  The INTERFACE_LINK_LIBRARIES property may contain
4>  configuration-sensitive generator-expressions which may be used to specify
4>  per-configuration rules.
4>Call Stack (most recent call first):
4>  CMakeLists.txt:113 (find_package)

Debug output of find_package(HDF5):

4>-- HDF5_DIR: HDF5_DIR-NOTFOUND
4>-- HDF5_DEFINITIONS: -DH5_BUILT_AS_DYNAMIC_LIB
4>-- HDF5_INCLUDE_DIRS: C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/include
4>-- HDF5_LIBRARIES: optimized;C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/lib/hdf5.lib;debug;C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/lib/hdf5_D.lib
4>-- HDF5_HL_LIBRARIES:
4>-- HDF5_C_DEFINITIONS:
4>-- HDF5_C_INCLUDE_DIR: C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/include
4>-- HDF5_C_INCLUDE_DIRS: C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/include
4>-- HDF5_C_LIBRARY:
4>-- HDF5_C_LIBRARIES: optimized;C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/lib/hdf5.lib;debug;C:/Users/krisf/Documents/devel/buildVC/SIRF-SuperBuild/INSTALL/lib/hdf5_D.lib
4>-- HDF5_C_HL_LIBRARY:
4>-- HDF5_C_HL_LIBRARIES:

I believe the offending line is at https://gitlab.kitware.com/cmake/cmake/-/blob/v3.19.2/Modules/FindHDF5.cmake#L994 and that instead we should use

target_link_libraries(HDF5::HDF5 INTERFACE "${HDF5_LIBRARIES}")

As you can see from the above, I'm using Visual Studio on Windows 10, with CMake 3.19.2, but the problem is in current master

Edited Jan 04, 2021 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking