From ec0816fe526bc77259ade427ebd42877e7506387 Mon Sep 17 00:00:00 2001 From: Markus Rickert Date: Sun, 10 Sep 2017 18:55:25 +0200 Subject: [PATCH] Add namespace to exported CMake targets --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2795c0c..99aa28f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,16 +320,17 @@ set (CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${NLOPT_VERSION_STRING include (CPack) # configuration files -export (TARGETS ${nlopt_lib} FILE ${PROJECT_BINARY_DIR}/NLoptLibraryDepends.cmake) +export (TARGETS ${nlopt_lib} NAMESPACE NLopt:: FILE ${PROJECT_BINARY_DIR}/NLoptLibraryDepends.cmake) # Install the export set for use with the install-tree install(EXPORT NLoptLibraryDepends + NAMESPACE NLopt:: DESTINATION ${RELATIVE_INSTALL_CMAKE_DIR} COMPONENT Development) # Create a NLOPTConfig.cmake file for the use from the install tree # and install it -set (NLOPT_LIBRARIES ${nlopt_lib}) +set (NLOPT_LIBRARIES "NLopt::${nlopt_lib}") set (NLOPT_CMAKE_DIR "${INSTALL_CMAKE_DIR}") file (RELATIVE_PATH rel_include_dir "${NLOPT_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}") -- 2.30.2