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

Last change on this file since 82 was 80, checked in by morasjul, 12 years ago

minor fix cocerning FindPacpus in case or Pacpus not found but not required
minor fix concerning -fpic option

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10# TODO: write the output variables of this CMake file.
11
12# Check PACPUS_ROOT
13if(NOT PACPUS_ROOT)
14 if(NOT ENV{PACPUS_ROOT} STREQUAL "")
15 set(PACPUS_ROOT $ENV{PACPUS_ROOT})
16 message(STATUS "Detected PACPUS_ROOT, set to '${PACPUS_ROOT}'")
17 else()
18 if(PACPUS_FIND_REQUIRED)
19 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
20 else()
21 MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
22 return()
23 endif()
24 endif()
25endif()
26
27
28
29# Hint directories
30set(PACPUS_INCLUDE_HINT ${PACPUS_ROOT}/include)
31set(PACPUS_LIBRARY_HINT ${PACPUS_ROOT}/lib)
32
33# Locate the include files
34find_path(
35 PACPUS_INCLUDE_DIR
36 NAMES
37 "Pacpus"
38 HINTS
39 ${PACPUS_INCLUDE_HINT}
40 DOC
41 "The Pacpus include directory"
42)
43
44# List of required modules
45set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
46if(WIN32)
47 list(APPEND PACPUS_MODULES "ROAD_TIME")
48endif()
49
50set(MODULE_MISSING FALSE)
51set(PACPUS_LIBRARIES "")
52
53# Check the presence of each module
54foreach(module ${PACPUS_MODULES})
55 find_library(
56 PACPUS_${module}_LIB
57 NAMES
58 ${module}
59 HINTS
60 ${PACPUS_LIBRARY_HINT}
61 )
62 find_library(
63 PACPUS_${module}_LIBD
64 NAMES
65 ${module}_d
66 HINTS
67 ${PACPUS_LIBRARY_HINT}
68 )
69
70 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD)
71 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})
72 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})
73 else()
74 set(MODULE_MISSING TRUE)
75 endif()
76endforeach()
77
78if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR)
79 set(PACPUS_FOUND TRUE)
80
81 # Configure Pacpus
82 list(APPEND CMAKE_MODULE_PATH "${PACPUS_ROOT}/cmake")
83 include(${PACPUS_ROOT}/cmake/PacpusUtilities.cmake)
84 include(${PACPUS_ROOT}/cmake/PacpusConfiguration.cmake)
85 include(${PACPUS_ROOT}/cmake/PacpusDependencies.cmake)
86 include(${PACPUS_ROOT}/cmake/PacpusPlatforms.cmake)
87
88 #set(CMAKE_INSTALL_PREFIX ${PACPUS_ROOT})
89 set(PACPUS_INSTALL_DIR ${PACPUS_ROOT})
90 set(PACPUS_LIB_DIR "${PACPUS_ROOT}/lib"
91)
92 MESSAGE(STATUS "PACPUS_ROOT found ${PACPUS_ROOT}")
93
94else()
95 set(PACPUS_FOUND FALSE)
96
97 if(PACPUS_FIND_REQUIRED)
98 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
99 else()
100 MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
101 endif()
102
103endif()
Note: See TracBrowser for help on using the repository browser.