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

Last change on this file since 91 was 91, checked in by DHERBOMEZ Gérald, 11 years ago

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 2.8 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 in environment, 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()
25else()
26 message(STATUS "Detected PACPUS_ROOT as argument with the path: '${PACPUS_ROOT}'")
27endif()
28
29
30
31# Hint directories
32set(PACPUS_INCLUDE_HINT ${PACPUS_ROOT}/include)
33set(PACPUS_LIBRARY_HINT ${PACPUS_ROOT}/lib)
34
35# Locate the include files
36find_path(
37 PACPUS_INCLUDE_DIR
38 NAMES
39 "Pacpus"
40 HINTS
41 ${PACPUS_INCLUDE_HINT}
42 DOC
43 "The Pacpus include directory"
44)
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 find_library(
58 PACPUS_${module}_LIB
59 NAMES
60 ${module}
61 HINTS
62 ${PACPUS_LIBRARY_HINT}
63 )
64 find_library(
65 PACPUS_${module}_LIBD
66 NAMES
67 ${module}_d
68 HINTS
69 ${PACPUS_LIBRARY_HINT}
70 )
71
72 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD)
73 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})
74 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})
75 else()
76 set(MODULE_MISSING TRUE)
77 endif()
78endforeach()
79
80if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR)
81 set(PACPUS_FOUND TRUE)
82
83 # Configure Pacpus
84 list(APPEND CMAKE_MODULE_PATH "${PACPUS_ROOT}/cmake")
85 include(${PACPUS_ROOT}/cmake/PacpusUtilities.cmake)
86 include(${PACPUS_ROOT}/cmake/PacpusConfiguration.cmake)
87 include(${PACPUS_ROOT}/cmake/PacpusDependencies.cmake)
88 include(${PACPUS_ROOT}/cmake/PacpusPlatforms.cmake)
89
90 #set(CMAKE_INSTALL_PREFIX ${PACPUS_ROOT})
91 set(PACPUS_INSTALL_DIR ${PACPUS_ROOT})
92 set(PACPUS_LIB_DIR "${PACPUS_ROOT}/lib")
93 MESSAGE(STATUS "PACPUS_ROOT found ${PACPUS_ROOT}")
94
95else()
96 set(PACPUS_FOUND FALSE)
97
98 if(PACPUS_FIND_REQUIRED)
99 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
100 else()
101 MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
102 endif()
103
104endif()
Note: See TracBrowser for help on using the repository browser.