source: pacpusframework/branches/0.0.x/cmake/FindPacpus.cmake@ 247

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

Modifications of the build system.
Improvement of the FindPacpus.cmake package.

  • Property svn:keywords set to Id
File size: 2.9 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 string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
17 message(STATUS "Detected PACPUS_ROOT in environment, set to '${PACPUS_ROOT}'")
18 else()
19 if(PACPUS_FIND_REQUIRED)
20 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
21 else()
22 MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
23 return()
24 endif()
25 endif()
26else()
27 string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
28 message(STATUS "Detected PACPUS_ROOT as argument with the path: '${PACPUS_ROOT}'")
29endif()
30
31
32
33# Hint directories
34set(PACPUS_INCLUDE_HINT ${PACPUS_ROOT}/include)
35set(PACPUS_LIBRARY_HINT ${PACPUS_ROOT}/lib)
36
37# Locate the include files
38find_path(
39 PACPUS_INCLUDE_DIR
40 NAMES
41 "Pacpus"
42 HINTS
43 ${PACPUS_INCLUDE_HINT}
44 DOC
45 "The Pacpus include directory"
46)
47
48# List of required modules
49set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
50if(WIN32)
51 list(APPEND PACPUS_MODULES "ROAD_TIME")
52endif()
53
54set(MODULE_MISSING FALSE)
55set(PACPUS_LIBRARIES "")
56
57# Check the presence of each module
58foreach(module ${PACPUS_MODULES})
59 find_library(
60 PACPUS_${module}_LIB
61 NAMES
62 ${module}
63 HINTS
64 ${PACPUS_LIBRARY_HINT}
65 )
66 find_library(
67 PACPUS_${module}_LIBD
68 NAMES
69 ${module}_d
70 HINTS
71 ${PACPUS_LIBRARY_HINT}
72 )
73
74 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD)
75 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})
76 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})
77 else()
78 set(MODULE_MISSING TRUE)
79 endif()
80endforeach()
81
82if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR)
83 set(PACPUS_FOUND TRUE)
84
85 # Configure Pacpus
86 list(APPEND CMAKE_MODULE_PATH "${PACPUS_ROOT}/cmake")
87 include(${PACPUS_ROOT}/cmake/PacpusUtilities.cmake)
88 include(${PACPUS_ROOT}/cmake/PacpusConfiguration.cmake)
89 include(${PACPUS_ROOT}/cmake/PacpusDependencies.cmake)
90 include(${PACPUS_ROOT}/cmake/PacpusPlatforms.cmake)
91
92 #set(CMAKE_INSTALL_PREFIX ${PACPUS_ROOT})
93 set(PACPUS_INSTALL_DIR ${PACPUS_ROOT})
94 set(PACPUS_LIB_DIR "${PACPUS_ROOT}/lib")
95 MESSAGE(STATUS "PACPUS_ROOT found ${PACPUS_ROOT}")
96
97else()
98 set(PACPUS_FOUND FALSE)
99
100 if(PACPUS_FIND_REQUIRED)
101 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
102 else()
103 MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
104 endif()
105
106endif()
Note: See TracBrowser for help on using the repository browser.