Files
Z80/support/Z80Config.cmake.in
2022-05-17 12:53:52 +02:00

62 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.19)
set(@PROJECT_NAME@_known_components Static Shared)
set(@PROJECT_NAME@_component_Static NO)
set(@PROJECT_NAME@_component_Shared NO)
foreach (@PROJECT_NAME@_component IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
if (@PROJECT_NAME@_component IN_LIST @PROJECT_NAME@_known_components)
set(@PROJECT_NAME@_component_${@PROJECT_NAME@_component} YES)
else()
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"@PROJECT_NAME@ does not recognize component `${@PROJECT_NAME@_component}`.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
endforeach()
if (@PROJECT_NAME@_component_Static AND @PROJECT_NAME@_component_Shared)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"@PROJECT_NAME@ `Static` and `Shared` components are mutually exclusive.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
set(@PROJECT_NAME@_Static_targets "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@StaticTargets.cmake")
set(@PROJECT_NAME@_Shared_targets "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@SharedTargets.cmake")
macro(@PROJECT_NAME@_load_targets type)
if (NOT EXISTS "${@PROJECT_NAME@_${type}_targets}")
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"@PROJECT_NAME@ `${type}` libraries were requested but not found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
include(CMakeFindDependencyMacro)
find_dependency(Zeta)
include("${@PROJECT_NAME@_${type}_targets}")
endmacro()
if(@PROJECT_NAME@_component_Static)
@PROJECT_NAME@_load_targets(Static)
elseif(@PROJECT_NAME@_component_Shared)
@PROJECT_NAME@_load_targets(Shared)
elseif(DEFINED @PROJECT_NAME@_SHARED_LIBS AND @PROJECT_NAME@_SHARED_LIBS)
@PROJECT_NAME@_load_targets(Shared)
elseif(DEFINED @PROJECT_NAME@_SHARED_LIBS AND NOT @PROJECT_NAME@_SHARED_LIBS)
@PROJECT_NAME@_load_targets(Static)
elseif(BUILD_SHARED_LIBS)
if(EXISTS "${@PROJECT_NAME@_Shared_targets}")
@PROJECT_NAME@_load_targets(Shared)
else()
@PROJECT_NAME@_load_targets(Static)
endif()
else()
if(EXISTS "${@PROJECT_NAME@_Static_targets}")
@PROJECT_NAME@_load_targets(Static)
else()
@PROJECT_NAME@_load_targets(Shared)
endif()
endif()