Примеры скриптов для поиска через find_package
This commit is contained in:
parent
e63e6a4c8a
commit
5645c5ea31
21
cmake/FindMyxlib.cmake
Normal file
21
cmake/FindMyxlib.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
set(MYXLIB_PREFIX "" CACHE PATH "The path to the previx of an myxlib installation")
|
||||
|
||||
find_path(MYXLIB_INCLUDE_DIRS NAMES myx/core/config.hpp PATHS ${MYXLIB_PREFIX}/include)
|
||||
find_library(MYXLIB_QT_LIBRARY NAMES myx-qt PATHS ${MYXLIB_PREFIX}/lib)
|
||||
find_library(MYXLIB_FILESYSTEM_LIBRARY NAMES myx-filesystem PATHS ${MYXLIB_PREFIX}/lib)
|
||||
|
||||
if(MYXLIB_INCLUDE_DIRS AND MYXLIB_QT_LIBRARY AND MYXLIB_FILESYSTEM_LIBRARY)
|
||||
get_filename_component(MYXLIB_LIBRARY_DIR ${MYXLIB_QT_LIBRARY} DIRECTORY CACHE)
|
||||
set(MYXLIB_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(MYXLIB_FOUND)
|
||||
if(NOT MYXLIB_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found myxlib")
|
||||
endif()
|
||||
set(HAVE_MYXLIB 1)
|
||||
elseif(MYXLIB_FOUND)
|
||||
if(MYXLIB_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find myxlib")
|
||||
endif()
|
||||
endif()
|
14
cmake/FindMyxlibThirdparty.cmake
Normal file
14
cmake/FindMyxlibThirdparty.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
ExternalProject_Add(
|
||||
myxlib
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/myxlib
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||
DOWNLOAD_COMMAND ""
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMLIB_MAIN_DIR=${CMLIB_MAIN_DIR} ${CMLIB_EXT_PROJ_DEFAULT_ARGS} <SOURCE_DIR>
|
||||
BUILD_COMMAND true
|
||||
)
|
||||
|
||||
set(MYXLIB_PREFIX ${CMAKE_BINARY_DIR} CACHE FILEPATH "" FORCE)
|
||||
set(MYXLIB_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "" FORCE)
|
||||
set(MYXLIB_LIBRARY_DIR ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} CACHE PATH "" FORCE)
|
||||
set(MYXLIB_QT_LIBRARY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libmyx-qt.a CACHE FILEPATH "" FORCE)
|
||||
set(MYXLIB_FILESYSTEM_LIBRARY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libmyx-filesystem.a CACHE FILEPATH "" FORCE)
|
Loading…
Reference in New Issue
Block a user