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

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

Fixed: versioning in PacpusConfig.cmake.in.

File size: 5.7 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: "1.2.3"
16# - Pacpus_MAJOR_VERSION : Major version part of Pacpus_VERSION. Example: "1"
17# - Pacpus_MINOR_VERSION : Minor version part of Pacpus_VERSION. Example: "2"
18# - Pacpus_PATCH_VERSION : Patch version part of Pacpus_VERSION. Example: "3"
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_MAJOR_VERSION @Pacpus_MAJOR_VERSION@)
51set(Pacpus_MINOR_VERSION @Pacpus_MINOR_VERSION@)
52set(Pacpus_PATCH_VERSION @Pacpus_PATCH_VERSION@)
53set(Pacpus_VERSION
54 "${Pacpus_MAJOR_VERSION}.${Pacpus_MINOR_VERSION}.${Pacpus_PATCH_VERSION}")
55
56# ====================================================================
57# Link libraries: e.g. libPacpusLib.so, PacpusLibd.lib, etc...
58# ====================================================================
59
60set(Pacpus_LIB_COMPONENTS
61 dbiteplayerlib
62 FileLib
63 PacpusLib
64 PacpusTools
65)
66if(WIN32)
67 list(APPEND Pacpus_LIB_COMPONENTS
68 ROAD_TIME
69 )
70endif()
71
72# ==============================================================
73set(_Pacpus_MODULE_MISSING FALSE)
74set(Pacpus_LIBS "")
75
76# Check the presence of each component
77foreach(__opttype RELEASE DEBUG)
78 if(${__opttype} STREQUAL DEBUG)
79 set(Pacpus_LIB_TYPE debug)
80 set(Pacpus_LIB_SUFFIX "_d")
81 else()
82 set(Pacpus_LIB_TYPE optimized)
83 set(Pacpus_LIB_SUFFIX "")
84 endif()
85 foreach(__component ${Pacpus_LIB_COMPONENTS})
86 find_library(
87 Pacpus_${__component}_LIB_${__opttype}
88 NAMES ${__component}${Pacpus_LIB_SUFFIX}
89 HINTS ${Pacpus_LIB_DIR_${__opttype}}
90 )
91 if(Pacpus_${__component}_LIB_${__opttype})
92 list(APPEND Pacpus_LIBS ${Pacpus_LIB_TYPE} ${Pacpus_${__component}_LIB_${__opttype}})
93 else()
94 message(SEND_ERROR "Cannot find Pacpus component ${__component}${Pacpus_LIB_SUFFIX} (${Pacpus_LIB_TYPE} version)")
95 set(_Pacpus_MODULE_MISSING TRUE)
96 endif()
97 endforeach()
98endforeach()
99
100# handle the QUIETLY and REQUIRED arguments and set PACPUS_FOUND to TRUE if
101# all listed variables are TRUE
102include (FindPackageHandleStandardArgs)
103set(Pacpus_ALL_MODULES_FOUND NOT _Pacpus_MODULE_MISSING)
104find_package_handle_standard_args (Pacpus DEFAULT_MSG Pacpus_LIBS Pacpus_INCLUDE_DIRS Pacpus_ALL_MODULES_FOUND)
105
106# ==============================================================
107set(Pacpus_INSTALL_DIR ${Pacpus_CONFIG_PATH})
108set(Pacpus_CMAKE_DIR ${Pacpus_CONFIG_PATH}/cmake)
109set(CMAKE_INSTALL_PREFIX ${Pacpus_INSTALL_DIR})
110list(APPEND CMAKE_PREFIX_PATH ${Pacpus_CMAKE_DIR})
111list(APPEND CMAKE_MODULE_PATH ${Pacpus_CMAKE_DIR})
112
113include(${Pacpus_CMAKE_DIR}/PacpusUtilities.cmake)
114include(${Pacpus_CMAKE_DIR}/PacpusConfiguration.cmake)
115include(${Pacpus_CMAKE_DIR}/PacpusDependencies.cmake)
116include(${Pacpus_CMAKE_DIR}/PacpusPlatforms.cmake)
117
118# ==============================================================
119# Compatibility stuff
120# ==============================================================
121set(Pacpus_ROOT ${Pacpus_CONFIG_PATH})
122if(CMAKE_BUILD_TYPE MATCHES "Debug")
123 set(Pacpus_LIB_DIR ${Pacpus_LIB_DIR_DEBUG} ${Pacpus_3RDPARTY_LIB_DIR_DEBUG})
124else()
125 set(Pacpus_LIB_DIR ${Pacpus_LIB_DIR_RELEASE} ${Pacpus_3RDPARTY_LIB_DIR_RELEASE})
126endif()
127set(Pacpus_LIBRARIES ${Pacpus_LIBS})
128set(Pacpus_INCLUDE_DIR ${Pacpus_INCLUDE_DIRS})
129
130set(PACPUS_ROOT ${Pacpus_ROOT})
131set(PACPUS_LIBRARIES ${Pacpus_LIBS})
132set(PACPUS_INCLUDE_DIR ${Pacpus_INCLUDE_DIR})
Note: See TracBrowser for help on using the repository browser.