api)\r
\r
get_target_property (NLOPT_PRIVATE_INCLUDE_DIRS ${nlopt_lib} INCLUDE_DIRECTORIES)\r
-target_include_directories (${nlopt_lib} INTERFACE "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/api>")\r
+target_include_directories (${nlopt_lib} INTERFACE "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/api>" "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")\r
\r
if (BUILD_SHARED_LIBS)\r
- target_compile_definitions (${nlopt_lib} INTERFACE -DNLOPT_DLL)\r
- target_compile_definitions (${nlopt_lib} INTERFACE -DNLOPT_DLL_EXPORT)\r
+ target_compile_definitions (${nlopt_lib} PUBLIC -DNLOPT_DLL)\r
+ target_compile_definitions (${nlopt_lib} PRIVATE -DNLOPT_DLL_EXPORT)\r
endif ()\r
\r
# pass -fPIC in case swig module is built with static library\r
include (CPack)\r
\r
# configuration files\r
-export (TARGETS ${nlopt_lib} FILE ${PROJECT_BINARY_DIR}/NLoptLibraryDepends.cmake)\r
+export (TARGETS ${nlopt_lib} NAMESPACE NLopt:: FILE ${PROJECT_BINARY_DIR}/NLoptLibraryDepends.cmake)\r
\r
# Install the export set for use with the install-tree\r
install(EXPORT NLoptLibraryDepends\r
+ NAMESPACE NLopt::\r
DESTINATION ${RELATIVE_INSTALL_CMAKE_DIR}\r
COMPONENT Development)\r
\r
# Create a NLOPTConfig.cmake file for the use from the install tree\r
# and install it\r
-set (NLOPT_LIBRARIES ${nlopt_lib})\r
+set (NLOPT_LIBRARIES "NLopt::${nlopt_lib}")\r
\r
set (NLOPT_CMAKE_DIR "${INSTALL_CMAKE_DIR}")\r
file (RELATIVE_PATH rel_include_dir "${NLOPT_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}")\r