Skip to content

Commit

Permalink
export cmake target (nanomsg#949)
Browse files Browse the repository at this point in the history
* export cmake target
* add compile definition NN_STATIC_LIB for depending targets
  • Loading branch information
qsodev authored and gdamore committed May 23, 2018
1 parent 8403098 commit fbcd061
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ endforeach ()

if (NN_STATIC_LIB)
add_library (${PROJECT_NAME} STATIC ${NN_SOURCES})
target_compile_definitions (${PROJECT_NAME} PUBLIC NN_STATIC_LIB)
else ()
add_library (${PROJECT_NAME} SHARED ${NN_SOURCES})
add_definitions (-DNN_SHARED_LIB)
Expand Down Expand Up @@ -366,11 +367,14 @@ if(NN_REQUIRED_LIBRARIES)
endforeach()
endif()
configure_file (pkgconfig.in ${PROJECT_NAME}.pc @ONLY)
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install (TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-target
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install (EXPORT ${PROJECT_NAME}-target DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} FILE ${PROJECT_NAME}-config.cmake)

0 comments on commit fbcd061

Please sign in to comment.