myx-cmake/MyxCMake/MyxCMakeConfig.cmake

55 lines
1.8 KiB
CMake

cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # IN_LIST operator
get_filename_component(MYX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
set(MYX_CMAKE_FUNCTIONS_DIR "${MYX_CMAKE_DIR}/functions")
if(NOT IS_DIRECTORY "${MYX_CMAKE_FUNCTIONS_DIR}")
message(STATUS "MyxCMake: Functions directory is not found.")
else()
if(NOT ${MYX_CMAKE_FUNCTIONS_DIR} IN_LIST CMAKE_MODULE_PATH)
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FUNCTIONS_DIR}")
endif()
endif()
set(MYX_CMAKE_THIRDPARTY_DIR "${MYX_CMAKE_DIR}/thirdparty")
if(NOT IS_DIRECTORY "${MYX_CMAKE_THIRDPARTY_DIR}")
message(STATUS "MyxCMake: Thirdparty submodule is not found.")
else()
if(NOT ${MYX_CMAKE_THIRDPARTY_DIR} IN_LIST CMAKE_MODULE_PATH)
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_THIRDPARTY_DIR}")
endif()
endif()
set(MYX_CMAKE_SANITIZERS_DIR "${MYX_CMAKE_DIR}/sanitizers")
if(NOT IS_DIRECTORY "${MYX_CMAKE_SANITIZERS_DIR}")
message(STATUS "MyxCMake: Sanitizers submodule is not found.")
else()
if(NOT ${MYX_CMAKE_SANITIZERS_DIR} IN_LIST CMAKE_MODULE_PATH)
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_SANITIZERS_DIR}")
find_package(Sanitizers)
endif()
endif()
set(MYX_CMAKE_FIND_DIR "${MYX_CMAKE_DIR}/find")
if(NOT IS_DIRECTORY "${MYX_CMAKE_FIND_DIR}")
message(STATUS "MyxCMake: Custom find submodules are not found.")
else()
if(NOT ${MYX_CMAKE_FIND_DIR} IN_LIST CMAKE_MODULE_PATH)
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_FIND_DIR}")
endif()
endif()
set(MYX_CMAKE_MODULES_DIR "${MYX_CMAKE_DIR}/modules")
if(NOT IS_DIRECTORY "${MYX_CMAKE_MODULES_DIR}")
message(FATAL_ERROR "MyxCMake: Requried modules directory is not found.")
else()
if(NOT ${MYX_CMAKE_MODULES_DIR} IN_LIST CMAKE_MODULE_PATH)
list(INSERT CMAKE_MODULE_PATH 0 "${MYX_CMAKE_MODULES_DIR}")
endif()
endif()
include(MyxCMakeCommon)
cmake_policy(POP)