| 1 |
cmake_minimum_required(VERSION 3.10) |
| 2 |
|
| 3 |
project(PluginTest) |
| 4 |
|
| 5 |
include(${CMAKE_CURRENT_BINARY_DIR}/../mods.cmake) |
| 6 |
get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) |
| 7 |
foreach(c ${configs}) |
| 8 |
string(TOUPPER "${c}" CONFIG) |
| 9 |
get_property(soname TARGET exp_example_mod_1 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) |
| 10 |
if(soname) |
| 11 |
message(STATUS "exp_example_mod_1 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname}") |
| 12 |
else() |
| 13 |
message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_NO_SONAME_${CONFIG} but should") |
| 14 |
endif() |
| 15 |
endforeach() |
| 16 |
|
| 17 |
# Parse the binary to check for SONAME if possible. |
| 18 |
if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") |
| 19 |
find_program(READELF_EXE readelf) |
| 20 |
if(READELF_EXE) |
| 21 |
add_custom_target(check_mod_soname ALL COMMAND |
| 22 |
${CMAKE_COMMAND} -Dreadelf=${READELF_EXE} |
| 23 |
-Dmod=$<TARGET_FILE:exp_example_mod_1> |
| 24 |
-P ${CMAKE_CURRENT_SOURCE_DIR}/../check_mod_soname.cmake |
| 25 |
) |
| 26 |
endif() |
| 27 |
endif() |