| [245] | 1 | # ===================================================================================
 | 
|---|
 | 2 | #  The Pacpus CMake configuration file
 | 
|---|
 | 3 | #
 | 
|---|
 | 4 | #  Usage from an external project:
 | 
|---|
 | 5 | #    In your CMakeLists.txt, add these lines:
 | 
|---|
 | 6 | #
 | 
|---|
 | 7 | #    FIND_PACKAGE(Pacpus REQUIRED)
 | 
|---|
 | 8 | #    TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${Pacpus_LIBS})
 | 
|---|
 | 9 | #
 | 
|---|
 | 10 | #    This file will define the following variables:
 | 
|---|
 | 11 | #      - Pacpus_LIBS                     : The list of libraries to links against.
 | 
|---|
 | 12 | #      - Pacpus_LIB_DIR                  : The directory(es) where lib files are. Calling LINK_DIRECTORIES
 | 
|---|
 | 13 | #                                          with this path is NOT needed.
 | 
|---|
 | 14 | #      - Pacpus_INCLUDE_DIRS             : The Pacpus include directories.
 | 
|---|
| [249] | 15 | #      - Pacpus_VERSION                  : The version of this Pacpus build. Example: "1.2.3"
 | 
|---|
 | 16 | #      - Pacpus_MAJOR_VERSION            : Major version part of Pacpus_VERSION. Example: "1"
 | 
|---|
 | 17 | #      - Pacpus_MINOR_VERSION            : Minor version part of Pacpus_VERSION. Example: "2"
 | 
|---|
 | 18 | #      - Pacpus_PATCH_VERSION            : Patch version part of Pacpus_VERSION. Example: "3"
 | 
|---|
| [245] | 19 | #
 | 
|---|
 | 20 | #    Advanced variables:
 | 
|---|
 | 21 | #      - Pacpus_CONFIG_PATH
 | 
|---|
 | 22 | #
 | 
|---|
 | 23 | # ===================================================================================
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | # Extract the directory where *this* file has been installed (determined at cmake run-time)
 | 
|---|
 | 26 | get_filename_component(Pacpus_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | # ======================================================
 | 
|---|
 | 29 | # Include directories to add to the user project:
 | 
|---|
 | 30 | # ======================================================
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | # Provide the include directories to the caller
 | 
|---|
 | 33 | set(Pacpus_INCLUDE_DIRS "${Pacpus_CONFIG_PATH}/include")
 | 
|---|
 | 34 | include_directories(${Pacpus_INCLUDE_DIRS})
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 | # ======================================================
 | 
|---|
 | 37 | # Link directories to add to the user project:
 | 
|---|
 | 38 | # ======================================================
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | # Provide the libs directories to the caller
 | 
|---|
 | 41 | set(Pacpus_LIB_DIR_RELEASE "${Pacpus_CONFIG_PATH}/lib" CACHE PATH "Path where release Pacpus libraries are located")
 | 
|---|
 | 42 | set(Pacpus_LIB_DIR_DEBUG "${Pacpus_CONFIG_PATH}/lib" CACHE PATH "Path where debug Pacpus libraries are located")
 | 
|---|
 | 43 | set(Pacpus_3RDPARTY_LIB_DIR_RELEASE "${Pacpus_CONFIG_PATH}/3rdparty/lib" CACHE PATH "Path where release 3rdparty Pacpus dependencies are located")
 | 
|---|
 | 44 | set(Pacpus_3RDPARTY_LIB_DIR_DEBUG "${Pacpus_CONFIG_PATH}/3rdparty/lib" CACHE PATH "Path where debug 3rdparty Pacpus dependencies are located")
 | 
|---|
 | 45 | mark_as_advanced(FORCE Pacpus_LIB_DIR_RELEASE Pacpus_LIB_DIR_DEBUG Pacpus_3RDPARTY_LIB_DIR_RELEASE Pacpus_3RDPARTY_LIB_DIR_DEBUG Pacpus_CONFIG_PATH)
 | 
|---|
 | 46 | 
 | 
|---|
 | 47 | # ======================================================
 | 
|---|
 | 48 | #  Version variables:
 | 
|---|
 | 49 | # ======================================================
 | 
|---|
| [249] | 50 | set(Pacpus_MAJOR_VERSION @Pacpus_MAJOR_VERSION@)
 | 
|---|
 | 51 | set(Pacpus_MINOR_VERSION @Pacpus_MINOR_VERSION@)
 | 
|---|
 | 52 | set(Pacpus_PATCH_VERSION @Pacpus_PATCH_VERSION@)
 | 
|---|
| [246] | 53 | set(Pacpus_VERSION
 | 
|---|
 | 54 |     "${Pacpus_MAJOR_VERSION}.${Pacpus_MINOR_VERSION}.${Pacpus_PATCH_VERSION}")
 | 
|---|
| [245] | 55 | 
 | 
|---|
 | 56 | # ====================================================================
 | 
|---|
 | 57 | # Link libraries: e.g.   libPacpusLib.so, PacpusLibd.lib, etc...
 | 
|---|
 | 58 | # ====================================================================
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 | set(Pacpus_LIB_COMPONENTS
 | 
|---|
 | 61 |     dbiteplayerlib
 | 
|---|
 | 62 |     FileLib
 | 
|---|
 | 63 |     PacpusLib
 | 
|---|
 | 64 |     PacpusTools
 | 
|---|
 | 65 | )
 | 
|---|
 | 66 | if(WIN32)
 | 
|---|
 | 67 |     list(APPEND Pacpus_LIB_COMPONENTS
 | 
|---|
 | 68 |         ROAD_TIME
 | 
|---|
 | 69 |     )
 | 
|---|
 | 70 | endif()
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 | # ==============================================================
 | 
|---|
 | 73 | set(_Pacpus_MODULE_MISSING FALSE)
 | 
|---|
 | 74 | set(Pacpus_LIBS "")
 | 
|---|
 | 75 | 
 | 
|---|
 | 76 | # Check the presence of each component
 | 
|---|
 | 77 | foreach(__opttype RELEASE DEBUG)
 | 
|---|
 | 78 |     if(${__opttype} STREQUAL DEBUG)
 | 
|---|
 | 79 |         set(Pacpus_LIB_TYPE debug)
 | 
|---|
 | 80 |         set(Pacpus_LIB_SUFFIX "_d")
 | 
|---|
 | 81 |     else()
 | 
|---|
 | 82 |         set(Pacpus_LIB_TYPE optimized)
 | 
|---|
 | 83 |         set(Pacpus_LIB_SUFFIX "")
 | 
|---|
 | 84 |     endif()
 | 
|---|
 | 85 |     foreach(__component ${Pacpus_LIB_COMPONENTS})
 | 
|---|
 | 86 |         find_library(
 | 
|---|
 | 87 |             Pacpus_${__component}_LIB_${__opttype}
 | 
|---|
 | 88 |             NAMES ${__component}${Pacpus_LIB_SUFFIX}
 | 
|---|
 | 89 |             HINTS ${Pacpus_LIB_DIR_${__opttype}}
 | 
|---|
 | 90 |         )
 | 
|---|
 | 91 |         if(Pacpus_${__component}_LIB_${__opttype})
 | 
|---|
 | 92 |             list(APPEND Pacpus_LIBS ${Pacpus_LIB_TYPE} ${Pacpus_${__component}_LIB_${__opttype}})
 | 
|---|
 | 93 |         else()
 | 
|---|
 | 94 |             message(SEND_ERROR "Cannot find Pacpus component ${__component}${Pacpus_LIB_SUFFIX} (${Pacpus_LIB_TYPE} version)")
 | 
|---|
 | 95 |             set(_Pacpus_MODULE_MISSING TRUE)
 | 
|---|
 | 96 |         endif()
 | 
|---|
 | 97 |     endforeach()
 | 
|---|
 | 98 | endforeach()
 | 
|---|
 | 99 | 
 | 
|---|
 | 100 | # handle the QUIETLY and REQUIRED arguments and set PACPUS_FOUND to TRUE if
 | 
|---|
 | 101 | # all listed variables are TRUE
 | 
|---|
 | 102 | include (FindPackageHandleStandardArgs)
 | 
|---|
 | 103 | set(Pacpus_ALL_MODULES_FOUND NOT _Pacpus_MODULE_MISSING)
 | 
|---|
 | 104 | find_package_handle_standard_args (Pacpus DEFAULT_MSG Pacpus_LIBS Pacpus_INCLUDE_DIRS Pacpus_ALL_MODULES_FOUND)
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | # ==============================================================
 | 
|---|
 | 107 | set(Pacpus_INSTALL_DIR ${Pacpus_CONFIG_PATH})
 | 
|---|
 | 108 | set(Pacpus_CMAKE_DIR ${Pacpus_CONFIG_PATH}/cmake)
 | 
|---|
 | 109 | set(CMAKE_INSTALL_PREFIX ${Pacpus_INSTALL_DIR})
 | 
|---|
 | 110 | list(APPEND CMAKE_PREFIX_PATH ${Pacpus_CMAKE_DIR})
 | 
|---|
 | 111 | list(APPEND CMAKE_MODULE_PATH ${Pacpus_CMAKE_DIR})
 | 
|---|
 | 112 | 
 | 
|---|
 | 113 | include(${Pacpus_CMAKE_DIR}/PacpusUtilities.cmake)
 | 
|---|
 | 114 | include(${Pacpus_CMAKE_DIR}/PacpusConfiguration.cmake)
 | 
|---|
 | 115 | include(${Pacpus_CMAKE_DIR}/PacpusDependencies.cmake)
 | 
|---|
 | 116 | include(${Pacpus_CMAKE_DIR}/PacpusPlatforms.cmake)
 | 
|---|
 | 117 | 
 | 
|---|
 | 118 | # ==============================================================
 | 
|---|
 | 119 | # Compatibility stuff
 | 
|---|
 | 120 | # ==============================================================
 | 
|---|
 | 121 | set(Pacpus_ROOT ${Pacpus_CONFIG_PATH})
 | 
|---|
 | 122 | if(CMAKE_BUILD_TYPE MATCHES "Debug")
 | 
|---|
 | 123 |     set(Pacpus_LIB_DIR ${Pacpus_LIB_DIR_DEBUG} ${Pacpus_3RDPARTY_LIB_DIR_DEBUG})
 | 
|---|
 | 124 | else()
 | 
|---|
 | 125 |     set(Pacpus_LIB_DIR ${Pacpus_LIB_DIR_RELEASE} ${Pacpus_3RDPARTY_LIB_DIR_RELEASE})
 | 
|---|
 | 126 | endif()
 | 
|---|
 | 127 | set(Pacpus_LIBRARIES ${Pacpus_LIBS})
 | 
|---|
 | 128 | set(Pacpus_INCLUDE_DIR ${Pacpus_INCLUDE_DIRS})
 | 
|---|
 | 129 | 
 | 
|---|
 | 130 | set(PACPUS_ROOT ${Pacpus_ROOT})
 | 
|---|
 | 131 | set(PACPUS_LIBRARIES ${Pacpus_LIBS})
 | 
|---|
 | 132 | set(PACPUS_INCLUDE_DIR ${Pacpus_INCLUDE_DIR})
 | 
|---|