Changeset 129 in pacpusframework
- Timestamp:
- Jul 30, 2013, 2:04:56 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/cmake/FindPacpus.cmake
r89 r129 10 10 # TODO: write the output variables of this CMake file. 11 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, 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() 12 # Locate the include files 13 set(PACPUS_INCLUDE_HINTS 14 "${PACPUS_ROOT}/include" 15 "$ENV{PACPUS_ROOT}/include" 16 ) 17 if(WIN32) 18 list(APPEND PACPUS_INCLUDE_HINTS 19 "C:/Program Files/Pacpus/include" 20 "C:/Program Files (x86)/Pacpus/include" 21 "C:/Pacpus/include" 22 "C:/lib/Pacpus/include" 23 "D:/Program Files/Pacpus/include" 24 "D:/Program Files (x86)/Pacpus/include" 25 "D:/Pacpus/include" 26 "D:/lib/Pacpus/include" 27 ) 28 else() 29 # TODO: add default paths no Unix-like systems 30 list(APPEND PACPUS_INCLUDE_HINTS 31 ) 32 endif() 33 find_path(PACPUS_INCLUDE_DIR 34 NAMES "Pacpus/kernel/pacpus.h" 35 HINTS ${PACPUS_INCLUDE_HINTS} 36 DOC "The Pacpus include directory" 37 ) 38 39 if(NOT PACPUS_INCLUDE_DIR) 40 message(FATAL_ERROR "Could not find PACPUS. Please set CMake variable PACPUS_ROOT or environment variable PACPUS_ROOT.") 25 41 endif() 26 42 27 28 29 # Hint directories 30 set(PACPUS_INCLUDE_HINT ${PACPUS_ROOT}/include) 31 set(PACPUS_LIBRARY_HINT ${PACPUS_ROOT}/lib) 32 33 # Locate the include files 34 find_path( 35 PACPUS_INCLUDE_DIR 36 NAMES 37 "Pacpus" 38 HINTS 39 ${PACPUS_INCLUDE_HINT} 40 DOC 41 "The Pacpus include directory" 42 ) 43 get_filename_component(PACPUS_ROOT ${PACPUS_INCLUDE_DIR}/.. ABSOLUTE) 44 set(PACPUS_LIB_DIR ${PACPUS_ROOT}/lib) 43 45 44 46 # List of required modules … … 53 55 # Check the presence of each module 54 56 foreach(module ${PACPUS_MODULES}) 57 # release version 55 58 find_library( 56 59 PACPUS_${module}_LIB 57 NAMES 58 ${module} 59 HINTS 60 ${PACPUS_LIBRARY_HINT} 60 NAMES ${module} 61 HINTS ${PACPUS_LIB_DIR} 61 62 ) 63 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD) 64 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB}) 65 else() 66 message(SEND_ERROR "Cannot find Pacpus module ${module} (release version)") 67 set(MODULE_MISSING TRUE) 68 endif() 69 70 # debug version 62 71 find_library( 63 72 PACPUS_${module}_LIBD 64 NAMES 65 ${module}_d 66 HINTS 67 ${PACPUS_LIBRARY_HINT} 73 NAMES ${module}_d 74 HINTS ${PACPUS_LIB_DIR} 68 75 ) 69 70 76 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD) 71 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})72 77 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD}) 73 78 else() 79 message(SEND_ERROR "Cannot find Pacpus module ${module}_d (debug version)") 74 80 set(MODULE_MISSING TRUE) 75 81 endif() 76 82 endforeach() 77 83 78 if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR) 79 set(PACPUS_FOUND TRUE) 84 # handle the QUIETLY and REQUIRED arguments and set PACPUS_FOUND to TRUE if 85 # all listed variables are TRUE 86 include (FindPackageHandleStandardArgs) 87 set(PACPUS_ALL_MODULES_FOUND NOT MODULE_MISSING) 88 find_package_handle_standard_args (PACPUS DEFAULT_MSG PACPUS_LIBRARIES PACPUS_INCLUDE_DIR PACPUS_ALL_MODULES_FOUND) 80 89 81 # Configure Pacpus 82 list(APPEND CMAKE_MODULE_PATH "${PACPUS_ROOT}/cmake") 83 include(${PACPUS_ROOT}/cmake/PacpusUtilities.cmake) 84 include(${PACPUS_ROOT}/cmake/PacpusConfiguration.cmake) 85 include(${PACPUS_ROOT}/cmake/PacpusDependencies.cmake) 86 include(${PACPUS_ROOT}/cmake/PacpusPlatforms.cmake) 87 88 #set(CMAKE_INSTALL_PREFIX ${PACPUS_ROOT}) 90 if(PACPUS_FOUND) 89 91 set(PACPUS_INSTALL_DIR ${PACPUS_ROOT}) 90 set(PACPUS_LIB_DIR "${PACPUS_ROOT}/lib" 91 ) 92 MESSAGE(STATUS "PACPUS_ROOT found ${PACPUS_ROOT}") 93 94 else() 95 set(PACPUS_FOUND FALSE) 96 97 if(PACPUS_FIND_REQUIRED) 98 MESSAGE(FATAL_ERROR "Could'not find PACPUS_ROOT ") 99 else() 100 MESSAGE(STATUS "Could'not find PACPUS_ROOT ") 101 endif() 102 92 set(PACPUS_CMAKE_DIR ${PACPUS_ROOT}/cmake) 93 set(CMAKE_INSTALL_PREFIX ${PACPUS_INSTALL_DIR}) 94 list(APPEND CMAKE_PREFIX_PATH ${PACPUS_CMAKE_DIR}) 95 list(APPEND CMAKE_MODULE_PATH "${PACPUS_CMAKE_DIR}") 96 97 include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake) 98 include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake) 99 include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake) 100 include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake) 103 101 endif()
Note:
See TracChangeset
for help on using the changeset viewer.