-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_find_package.cmake
More file actions
41 lines (33 loc) · 1.35 KB
/
test_find_package.cmake
File metadata and controls
41 lines (33 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# CMake Config Validation Test
# Test standardized CMake config files
cmake_minimum_required(VERSION 3.16)
# Set CMAKE_PREFIX_PATH to find our config files
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build" ${CMAKE_PREFIX_PATH})
# Test 1: Find package with standardized naming
message(STATUS "Testing find_package(thread_system CONFIG REQUIRED)...")
find_package(thread_system CONFIG REQUIRED)
if(thread_system_FOUND)
message(STATUS "PASS: thread_system found with config files")
message(STATUS " Libraries: ${thread_system_LIBRARIES}")
# Test component targets
foreach(target ${thread_system_COMPONENT_TARGETS})
if(TARGET ${target})
message(STATUS " Target available: ${target}")
else()
message(STATUS " Target missing: ${target}")
endif()
endforeach()
else()
message(FATAL_ERROR "FAIL: thread_system not found")
endif()
# Test 2: Component-based find
message(STATUS "Testing component-based find...")
find_package(thread_system CONFIG REQUIRED COMPONENTS thread_pool service_container)
if(thread_system_FOUND)
message(STATUS "PASS: Component-based find successful")
else()
message(STATUS "FAIL: Component-based find failed")
endif()
message(STATUS "")
message(STATUS "thread_system CMake Config Validation Complete")
message(STATUS "==========================================")