| 1 | #################################################
|
|---|
| 2 | # ___________ ____ ______ __ __ _____ #
|
|---|
| 3 | # \____ \__ \ _/ ___\\____ \| | \/ ___/ #
|
|---|
| 4 | # | |_> > __ \\ \___| |_> > | /\___ \ #
|
|---|
| 5 | # | __(____ /\___ > __/|____//____ > #
|
|---|
| 6 | # |__| \/ \/|__| \/ #
|
|---|
| 7 | # #
|
|---|
| 8 | #################################################
|
|---|
| 9 |
|
|---|
| 10 | # TODO: write the output variables of this CMake file.
|
|---|
| 11 |
|
|---|
| 12 | # Check PACPUS_ROOT
|
|---|
| 13 | if(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()
|
|---|
| 25 | else()
|
|---|
| 26 | message(STATUS "Detected PACPUS_ROOT as argument with the path: '${PACPUS_ROOT}'")
|
|---|
| 27 | endif()
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | # Hint directories
|
|---|
| 32 | set(PACPUS_INCLUDE_HINT ${PACPUS_ROOT}/include)
|
|---|
| 33 | set(PACPUS_LIBRARY_HINT ${PACPUS_ROOT}/lib)
|
|---|
| 34 |
|
|---|
| 35 | # Locate the include files
|
|---|
| 36 | find_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
|
|---|
| 47 | set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib")
|
|---|
| 48 | if(WIN32)
|
|---|
| 49 | list(APPEND PACPUS_MODULES "ROAD_TIME")
|
|---|
| 50 | endif()
|
|---|
| 51 |
|
|---|
| 52 | set(MODULE_MISSING FALSE)
|
|---|
| 53 | set(PACPUS_LIBRARIES "")
|
|---|
| 54 |
|
|---|
| 55 | # Check the presence of each module
|
|---|
| 56 | foreach(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()
|
|---|
| 78 | endforeach()
|
|---|
| 79 |
|
|---|
| 80 | if(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 |
|
|---|
| 95 | else()
|
|---|
| 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 |
|
|---|
| 104 | endif()
|
|---|