Skip to content

Commit

Permalink
Add CMake modules export to build/install
Browse files Browse the repository at this point in the history
  • Loading branch information
plstcharles committed Nov 29, 2016
1 parent 581cc19 commit a635fd9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
27 changes: 27 additions & 0 deletions cmake/FrameworkPackGen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ endforeach()
set(RUNTIME_INSTALL_DIR "bin")
set(INCLUDE_INSTALL_DIR "include")
set(LIBRARY_INSTALL_DIR "lib")
set(MODULES_INSTALL_DIR "lib/cmake/Modules")
set(CONFIG_INSTALL_DIR "etc/litiv")
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/cmake/generated/litiv-config-version.cmake"
Expand All @@ -65,6 +66,18 @@ file(
DESTINATION
"${CMAKE_BINARY_DIR}"
)
file(
COPY
"${CMAKE_SOURCE_DIR}/cmake/checks"
DESTINATION
"${CMAKE_BINARY_DIR}/cmake/"
)
file(
COPY
"${CMAKE_SOURCE_DIR}/cmake/Modules"
DESTINATION
"${CMAKE_BINARY_DIR}/cmake/"
)
if(WIN32)
set(package_config_install_dirs
"lib/cmake/litiv"
Expand Down Expand Up @@ -94,6 +107,7 @@ while(package_config_install_dir_index LESS package_config_install_dir_count)
RUNTIME_INSTALL_DIR
INCLUDE_INSTALL_DIR
LIBRARY_INSTALL_DIR
MODULES_INSTALL_DIR
CONFIG_INSTALL_DIR
)
install(
Expand Down Expand Up @@ -123,10 +137,23 @@ export(
FILE
"${CMAKE_BINARY_DIR}/litiv-targets.cmake"
)
install(
DIRECTORY
"${CMAKE_SOURCE_DIR}/cmake/checks"
DESTINATION
"lib/cmake"
)
install(
DIRECTORY
"${CMAKE_SOURCE_DIR}/cmake/Modules"
DESTINATION
"lib/cmake"
)

set(CURRENT_CONFIG_INSTALL 0)
set(LITIV_BUILD_RUNTIME_DIR "${CMAKE_BINARY_DIR}/bin")
set(LITIV_BUILD_LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib")
set(LITIV_BUILD_MODULES_DIR "${CMAKE_BINARY_DIR}/cmake/Modules")
set(LITIV_BUILD_CONFIG_DIR "${CMAKE_BINARY_DIR}/etc/litiv")
set(LITIV_BUILD_INCLUDE_DIRS "${litiv_build_includedirs}")

Expand Down
12 changes: 10 additions & 2 deletions cmake/litiv-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# * LITIV_RUNTIME_DIRS : Directory(ies) where executables and DLLs are located; typically not needed by CMake projects
# * LITIV_INCLUDE_DIRS : Directory(ies) where headers are located; typically not needed by CMake projects
# * LITIV_LIBRARY_DIRS : Directory(ies) where libraries are located; typically not needed by CMake projects
# * LITIV_MODULES_DIRS : Directory(ies) where cmake modules are located; automatically added to CMAKE_MODULE_PATH
# * LITIV_CONFIG_DIRS : Directory(ies) where config/model files; typically not needed by CMake projects
# LITIV_EXT_INCLUDE_DIRS : Directories where headers for external dependencies are located
# * LITIV_COMPONENTS : List of all built framework components which can be used externally
Expand Down Expand Up @@ -60,19 +61,24 @@ if(LITIV_INSTALLED)
set_and_check(LITIV_RUNTIME_DIRS "@PACKAGE_RUNTIME_INSTALL_DIR@")
set_and_check(LITIV_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(LITIV_LIBRARY_DIRS "@PACKAGE_LIBRARY_INSTALL_DIR@")
set_and_check(LITIV_MODULES_DIRS "@PACKAGE_MODULES_INSTALL_DIR@")
#set_and_check(LITIV_CONFIG_DIRS "@PACKAGE_CONFIG_INSTALL_DIR@")
else()
set(LITIV_RUNTIME_DIRS "@LITIV_BUILD_RUNTIME_DIR@")
set(LITIV_INCLUDE_DIRS "@LITIV_BUILD_INCLUDE_DIRS@")
set(LITIV_LIBRARY_DIRS "@LITIV_BUILD_LIBRARY_DIR@")
set(LITIV_MODULES_DIRS "@LITIV_BUILD_MODULES_DIR@")
#set(LITIV_CONFIG_DIRS "@LITIV_BUILD_CONFIG_DIR@")
endif()
list(APPEND CMAKE_MODULE_PATH "${LITIV_MODULES_DIRS}")
set(LITIV_COMPONENTS "@LITIV_COMPONENTS@")

include(CMakeFindDependencyMacro)
set(LITIV_EXT_INCLUDE_DIRS "")
message(STATUS "LITIV Framework searching for OpenCV >=3.0 dependency...")
find_dependency(OpenCV 3.0)
if(@USE_GLSL@)
message(STATUS "LITIV Framework searching for OpenGL dependencies...")
find_dependency(OpenGL)
list(APPEND LITIV_EXT_INCLUDE_DIRS "${OpenGL_INCLUDE_DIRS}")
find_dependency(GLEW)
Expand All @@ -88,11 +94,12 @@ if(@USE_GLSL@)
endif()
endif()
if(@USE_OPENGM@)
find_dependency(OpenGM)
# ...
message(STATUS "LITIV Framework searching for OpenGM dependency with external lib...")
find_package(OpenGM REQUIRED COMPONENTS ext) # not using find_dependency due to component here
endif()
if(WIN32)
if(@USE_KINECTSDK@)
message(STATUS "LITIV Framework searching for KinectSDK2 dependency...")
find_dependency(KinectSDK2)
list(APPEND LITIV_EXT_INCLUDE_DIRS "${KinectSDK2_INCLUDE_DIRS}")
endif()
Expand All @@ -108,6 +115,7 @@ mark_as_advanced(
LITIV_RUNTIME_DIRS
LITIV_INCLUDE_DIRS
LITIV_LIBRARY_DIRS
LITIV_MODULES_DIRS
#LITIV_CONFIG_DIRS
LITIV_COMPONENTS
LITIV_VERSION
Expand Down

0 comments on commit a635fd9

Please sign in to comment.