Files
pico/projects/Z80/support/Z80Config.cmake.in

63 lines
2.0 KiB
CMake
Vendored

cmake_minimum_required(VERSION 3.0...${CMAKE_VERSION})
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 MATCHES "^(Static|Shared)$")
set(@PROJECT_NAME@_component_${@PROJECT_NAME@_component} YES)
else()
set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"`${@PROJECT_NAME@_component}` is not a valid 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
"`Static` and `Shared` 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
"`${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()