source: pacpusframework/trunk/cmake/FindPacpus.cmake@ 227

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

Fixed: FindPacpus.cmake false error message.

  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10# TODO: write the output variables of this CMake file.
11
12# Locate the include files
13set(PACPUS_INCLUDE_HINTS
14 "${PACPUS_ROOT}/include"
15 "$ENV{PACPUS_ROOT}/include"
16)
17if(WIN32)
18 list(APPEND PACPUS_INCLUDE_HINTS
19 "C:/Program Files/Pacpus/include"
20 "C:/Program Files (x86)/Pacpus/include"
21 "C:/Pacpus/include"
22 "C:/lib/Pacpus/include"
23 "D:/Program Files/Pacpus/include"
24 "D:/Program Files (x86)/Pacpus/include"
25 "D:/Pacpus/include"
26 "D:/lib/Pacpus/include"
27 )
28else()
29 # TODO: add default paths no Unix-like systems
30 list(APPEND PACPUS_INCLUDE_HINTS
31 )
32endif()
33find_path(PACPUS_INCLUDE_DIR
34 NAMES "Pacpus/kernel/pacpus.h"
35 HINTS ${PACPUS_INCLUDE_HINTS}
36 DOC "The Pacpus include directory"
37)
38
39if(NOT PACPUS_INCLUDE_DIR)
40 message(FATAL_ERROR "Could not find PACPUS. Please set CMake variable PACPUS_ROOT or environment variable PACPUS_ROOT.")
41endif()
42
43get_filename_component(PACPUS_ROOT ${PACPUS_INCLUDE_DIR}/.. ABSOLUTE)
44set(PACPUS_LIB_DIR ${PACPUS_ROOT}/lib)
45
46# List of required modules
47set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
48if(WIN32)
49 list(APPEND PACPUS_MODULES "ROAD_TIME")
50endif()
51
52set(MODULE_MISSING FALSE)
53set(PACPUS_LIBRARIES "")
54
55# Check the presence of each module
56foreach(module ${PACPUS_MODULES})
57 # release version
58 find_library(
59 PACPUS_${module}_LIB
60 NAMES ${module}
61 HINTS ${PACPUS_LIB_DIR}
62 )
63 if(PACPUS_${module}_LIB)
64 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})
65 else()
66 message(SEND_ERROR "Cannot find Pacpus module ${module} (release version)")
67 set(MODULE_MISSING TRUE)
68 endif()
69
70 # debug version
71 find_library(
72 PACPUS_${module}_LIBD
73 NAMES ${module}_d
74 HINTS ${PACPUS_LIB_DIR}
75 )
76 if(PACPUS_${module}_LIBD)
77 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})
78 else()
79 message(SEND_ERROR "Cannot find Pacpus module ${module}_d (debug version)")
80 set(MODULE_MISSING TRUE)
81 endif()
82endforeach()
83
84# handle the QUIETLY and REQUIRED arguments and set PACPUS_FOUND to TRUE if
85# all listed variables are TRUE
86include (FindPackageHandleStandardArgs)
87set(PACPUS_ALL_MODULES_FOUND NOT MODULE_MISSING)
88find_package_handle_standard_args (PACPUS DEFAULT_MSG PACPUS_LIBRARIES PACPUS_INCLUDE_DIR PACPUS_ALL_MODULES_FOUND)
89
90if(PACPUS_FOUND)
91 set(PACPUS_INSTALL_DIR ${PACPUS_ROOT})
92 set(PACPUS_CMAKE_DIR ${PACPUS_ROOT}/cmake)
93 set(CMAKE_INSTALL_PREFIX ${PACPUS_INSTALL_DIR})
94 list(APPEND CMAKE_PREFIX_PATH ${PACPUS_CMAKE_DIR})
95 list(APPEND CMAKE_MODULE_PATH "${PACPUS_CMAKE_DIR}")
96
97 include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
98 include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
99 include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
100 include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
101endif()
Note: See TracBrowser for help on using the repository browser.