noloader / cryptopp-cmake

CMake files for Crypto++ project
BSD 3-Clause "New" or "Revised" License
92 stars 67 forks source link

Wrong way to add export for the static version of the lib resulting in a warning with unintended consequences #91

Closed abdes closed 2 years ago

abdes commented 2 years ago
[build] CMake Warning (dev) at third_party/cryptopp-cmake/CMakeLists.txt:1296 (export):
[build]   Policy CMP0103 is not set: Multiple export() with same FILE without APPEND
[build]   is not allowed.  Run "cmake --help-policy CMP0103" for policy details.  Use
[build]   the cmake_policy command to set the policy and suppress this warning.
[build] 
[build]   export() command already specified for the file
[build] 
[build]     cryptopp-targets.cmake
[build] 
[build]   Did you miss 'APPEND' keyword?
[build] This warning is for project developers.  Use -Wno-dev to suppress it.

The proper way to do this is to add APPEND to the export as suggested by cmake.

# Development package
if (BUILD_STATIC)
  export(TARGETS cryptopp-static FILE ${export_name}.cmake APPEND)
  install(TARGETS cryptopp-static EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif ()