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

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

Minor: PacpusConfig.cmake.in -> version.

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