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

Last change on this file since 167 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
RevLine 
[9]1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10# TODO: write the output variables of this CMake file.
11
12# Check PACPUS_ROOT
[50]13if(NOT PACPUS_ROOT)
14 if(NOT ENV{PACPUS_ROOT} STREQUAL "")
15 set(PACPUS_ROOT $ENV{PACPUS_ROOT})
[101]16 string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
[91]17 message(STATUS "Detected PACPUS_ROOT in environment, set to '${PACPUS_ROOT}'")
[80]18 else()
19 if(PACPUS_FIND_REQUIRED)
[91]20 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ")
[80]21 else()
[91]22 MESSAGE(STATUS "Could'not find PACPUS_ROOT ")
23 return()
[80]24 endif()
[50]25 endif()
[91]26else()
[101]27 string (REPLACE "\\" "/" PACPUS_ROOT ${PACPUS_ROOT})
28 message(STATUS "Detected PACPUS_ROOT as argument with the path: '${PACPUS_ROOT}'")
[9]29endif()
30
31
[80]32
[9]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(
[50]39 PACPUS_INCLUDE_DIR
40 NAMES
41 "Pacpus"
42 HINTS
43 ${PACPUS_INCLUDE_HINT}
44 DOC
45 "The Pacpus include directory"
[9]46)
47
48# List of required modules
49set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
[50]50if(WIN32)
51 list(APPEND PACPUS_MODULES "ROAD_TIME")
[9]52endif()
53
54set(MODULE_MISSING FALSE)
55set(PACPUS_LIBRARIES "")
56
57# Check the presence of each module
58foreach(module ${PACPUS_MODULES})
[50]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 )
[9]73
[50]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()
[9]80endforeach()
81
82if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR)
[50]83 set(PACPUS_FOUND TRUE)
[80]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})
[91]94 set(PACPUS_LIB_DIR "${PACPUS_ROOT}/lib")
[80]95 MESSAGE(STATUS "PACPUS_ROOT found ${PACPUS_ROOT}")
96
[9]97else()
[50]98 set(PACPUS_FOUND FALSE)
[80]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
[9]106endif()
Note: See TracBrowser for help on using the repository browser.