CMakeLists.txt 1.3 KB

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