Skip to content

Commit

Permalink
Some more fixes to CMake project structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmhofmann committed Dec 27, 2017
1 parent cbc7308 commit cb94658
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ endif()
#------------------------------------------------------------------------------

add_library(selene_base "")
add_library(selene::selene_base ALIAS selene_base)

target_sources(selene_base
PRIVATE
Expand Down Expand Up @@ -32,6 +33,7 @@ target_include_directories(selene_base
#------------------------------------------------------------------------------

add_library(selene_img "")
add_library(selene::selene_img ALIAS selene_img)

target_sources(selene_img
PRIVATE
Expand Down Expand Up @@ -98,7 +100,7 @@ if (JPEG_FOUND)
SELENE_LIBJPEG_EXTENDED_COLORSPACES)
endif()
target_include_directories(selene_img
PRIVATE
PUBLIC
${JPEG_INCLUDE_DIR})
target_link_libraries(selene_img
PUBLIC
Expand All @@ -110,7 +112,7 @@ if (PNG_FOUND)
PUBLIC
SELENE_WITH_LIBPNG)
target_include_directories(selene_img
PRIVATE
PUBLIC
${PNG_INCLUDE_DIR})
target_link_libraries(selene_img
PUBLIC
Expand All @@ -122,7 +124,7 @@ if (OPENCV_CORE_FOUND)
PUBLIC
SELENE_WITH_OPENCV)
target_include_directories(selene_img
PRIVATE
PUBLIC
${OpenCV_INCLUDE_DIRS})
target_link_libraries(selene_img
PUBLIC
Expand All @@ -136,6 +138,7 @@ target_link_libraries(selene_img
#------------------------------------------------------------------------------

add_library(selene_io "")
add_library(selene::selene_io ALIAS selene_io)

target_sources(selene_io
PRIVATE
Expand All @@ -162,6 +165,7 @@ target_include_directories(selene_io
#------------------------------------------------------------------------------

add_library(selene_thread INTERFACE)
add_library(selene::selene_thread ALIAS selene_thread)

target_sources(selene_thread
INTERFACE
Expand All @@ -178,6 +182,7 @@ target_include_directories(selene_thread
#------------------------------------------------------------------------------

add_library(selene INTERFACE)
add_library(selene::selene ALIAS selene)

target_include_directories(selene
INTERFACE
Expand All @@ -194,17 +199,19 @@ target_link_libraries(selene
#------------------------------------------------------------------------------

install(TARGETS selene_base selene_img selene_io selene_thread selene
EXPORT SeleneTargets
EXPORT selene-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/selene
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp")

install(EXPORT SeleneTargets
FILE SeleneTargets.cmake
install(EXPORT selene-targets
FILE selene-targets.cmake
NAMESPACE selene::
DESTINATION lib/cmake/selene)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/selene)

install(FILES "selene-config.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/selene)
7 changes: 7 additions & 0 deletions src/selene-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include(CMakeFindDependencyMacro)

find_dependency(JPEG)
find_dependency(PNG 1.6)
find_dependency(OpenCV)

include("${CMAKE_CURRENT_LIST_DIR}/selene-targets.cmake")

0 comments on commit cb94658

Please sign in to comment.