source: pacpusframework/trunk/cmake/PacpusConfig.cmake.in@ 245

Last change on this file since 245 was 245, checked in by Marek Kurdej, 11 years ago

Added: PacpusConfig.cmake.in stub.

File size: 5.5 KB
Line 
1# ===================================================================================
2# The Pacpus CMake configuration file
3#
4# Usage from an external project:
5# In your CMakeLists.txt, add these lines:
6#
7# FIND_PACKAGE(Pacpus REQUIRED)
8# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${Pacpus_LIBS})
9#
10# This file will define the following variables:
11# - Pacpus_LIBS : The list of libraries to links against.
12# - Pacpus_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES
13# with this path is NOT needed.
14# - Pacpus_INCLUDE_DIRS : The Pacpus include directories.
15# - Pacpus_VERSION : The version of this Pacpus build. Example: "2.4.0"
16# - Pacpus_VERSION_MAJOR : Major version part of Pacpus_VERSION. Example: "2"
17# - Pacpus_VERSION_MINOR : Minor version part of Pacpus_VERSION. Example: "4"
18# - Pacpus_VERSION_PATCH : Patch version part of Pacpus_VERSION. Example: "0"
19#
20# Advanced variables:
21# - Pacpus_CONFIG_PATH
22#
23# ===================================================================================
24
25# Extract the directory where *this* file has been installed (determined at cmake run-time)
26get_filename_component(Pacpus_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
27
28# ======================================================
29# Include directories to add to the user project:
30# ======================================================
31
32# Provide the include directories to the caller
33set(Pacpus_INCLUDE_DIRS "${Pacpus_CONFIG_PATH}/include")
34include_directories(${Pacpus_INCLUDE_DIRS})
35
36# ======================================================
37# Link directories to add to the user project:
38# ======================================================
39
40# Provide the libs directories to the caller
41set(Pacpus_LIB_DIR_RELEASE "${Pacpus_CONFIG_PATH}/lib" CACHE PATH "Path where release Pacpus libraries are located")
42set(Pacpus_LIB_DIR_DEBUG "${Pacpus_CONFIG_PATH}/lib" CACHE PATH "Path where debug Pacpus libraries are located")
43set(Pacpus_3RDPARTY_LIB_DIR_RELEASE "${Pacpus_CONFIG_PATH}/3rdparty/lib" CACHE PATH "Path where release 3rdparty Pacpus dependencies are located")
44set(Pacpus_3RDPARTY_LIB_DIR_DEBUG "${Pacpus_CONFIG_PATH}/3rdparty/lib" CACHE PATH "Path where debug 3rdparty Pacpus dependencies are located")
45mark_as_advanced(FORCE Pacpus_LIB_DIR_RELEASE Pacpus_LIB_DIR_DEBUG Pacpus_3RDPARTY_LIB_DIR_RELEASE Pacpus_3RDPARTY_LIB_DIR_DEBUG Pacpus_CONFIG_PATH)
46
47# ======================================================
48# Version variables:
49# ======================================================
50set(Pacpus_VERSION 0.2.0)
51set(Pacpus_VERSION_MAJOR 0)
52set(Pacpus_VERSION_MINOR 2)
53set(Pacpus_VERSION_PATCH 0)
54
55# ====================================================================
56# Link libraries: e.g. libPacpusLib.so, PacpusLibd.lib, etc...
57# ====================================================================
58
59set(Pacpus_LIB_COMPONENTS
60 dbiteplayerlib
61 FileLib
62 PacpusLib
63 PacpusTools
64)
65if(WIN32)
66 list(APPEND Pacpus_LIB_COMPONENTS
67 ROAD_TIME
68 )
69endif()
70
71# ==============================================================
72set(_Pacpus_MODULE_MISSING FALSE)
73set(Pacpus_LIBS "")
74
75# Check the presence of each component
76foreach(__opttype RELEASE DEBUG)
77 if(${__opttype} STREQUAL DEBUG)
78 set(Pacpus_LIB_TYPE debug)
79 set(Pacpus_LIB_SUFFIX "_d")
80 else()
81 set(Pacpus_LIB_TYPE optimized)
82 set(Pacpus_LIB_SUFFIX "")
83 endif()
84 foreach(__component ${Pacpus_LIB_COMPONENTS})
85 find_library(
86 Pacpus_${__component}_LIB_${__opttype}
87 NAMES ${__component}${Pacpus_LIB_SUFFIX}
88 HINTS ${Pacpus_LIB_DIR_${__opttype}}
89 )
90 if(Pacpus_${__component}_LIB_${__opttype})
91 list(APPEND Pacpus_LIBS ${Pacpus_LIB_TYPE} ${Pacpus_${__component}_LIB_${__opttype}})
92 else()
93 message(SEND_ERROR "Cannot find Pacpus component ${__component}${Pacpus_LIB_SUFFIX} (${Pacpus_LIB_TYPE} version)")
94 set(_Pacpus_MODULE_MISSING TRUE)
95 endif()
96 endforeach()
97endforeach()
98
99# handle the QUIETLY and REQUIRED arguments and set PACPUS_FOUND to TRUE if
100# all listed variables are TRUE
101include (FindPackageHandleStandardArgs)
102set(Pacpus_ALL_MODULES_FOUND NOT _Pacpus_MODULE_MISSING)
103find_package_handle_standard_args (Pacpus DEFAULT_MSG Pacpus_LIBS Pacpus_INCLUDE_DIRS Pacpus_ALL_MODULES_FOUND)
104
105# ==============================================================
106set(Pacpus_INSTALL_DIR ${Pacpus_CONFIG_PATH})
107set(Pacpus_CMAKE_DIR ${Pacpus_CONFIG_PATH}/cmake)
108set(CMAKE_INSTALL_PREFIX ${Pacpus_INSTALL_DIR})
109list(APPEND CMAKE_PREFIX_PATH ${Pacpus_CMAKE_DIR})
110list(APPEND CMAKE_MODULE_PATH ${Pacpus_CMAKE_DIR})
111
112include(${Pacpus_CMAKE_DIR}/PacpusUtilities.cmake)
113include(${Pacpus_CMAKE_DIR}/PacpusConfiguration.cmake)
114include(${Pacpus_CMAKE_DIR}/PacpusDependencies.cmake)
115include(${Pacpus_CMAKE_DIR}/PacpusPlatforms.cmake)
116
117# ==============================================================
118# Compatibility stuff
119# ==============================================================
120set(Pacpus_ROOT ${Pacpus_CONFIG_PATH})
121if(CMAKE_BUILD_TYPE MATCHES "Debug")
122 set(Pacpus_LIB_DIR ${Pacpus_LIB_DIR_DEBUG} ${Pacpus_3RDPARTY_LIB_DIR_DEBUG})
123else()
124 set(Pacpus_LIB_DIR ${Pacpus_LIB_DIR_RELEASE} ${Pacpus_3RDPARTY_LIB_DIR_RELEASE})
125endif()
126set(Pacpus_LIBRARIES ${Pacpus_LIBS})
127set(Pacpus_INCLUDE_DIR ${Pacpus_INCLUDE_DIRS})
128
129set(PACPUS_ROOT ${Pacpus_ROOT})
130set(PACPUS_LIBRARIES ${Pacpus_LIBS})
131set(PACPUS_INCLUDE_DIR ${Pacpus_INCLUDE_DIR})
Note: See TracBrowser for help on using the repository browser.