summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/INSTALL_NAME_DIR/INSTALL_NAME_DIR.cmake
blob: eaa0b456a6eeb6a192d0877ddeabdded1b2f92c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function(add_install_name_dir_libraries install_name_dir)
  add_library(build_dir SHARED test.c)
  add_library(install_dir SHARED test.c)
  if(NOT install_name_dir STREQUAL "NONE")
    set_target_properties(build_dir install_dir PROPERTIES
      INSTALL_NAME_DIR "${install_name_dir}"
      )
  endif()
  set_target_properties(install_dir PROPERTIES
    BUILD_WITH_INSTALL_NAME_DIR TRUE
    )
  install(TARGETS build_dir install_dir EXPORT InstallNameDirTest DESTINATION lib)
  install(EXPORT InstallNameDirTest DESTINATION lib/cmake/InstallNameDirTest FILE InstallNameDirTest-targets.cmake)
  file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/targets.txt" CONTENT "$<TARGET_FILE:build_dir>\n$<TARGET_FILE:install_dir>\n" CONDITION $<CONFIG:Debug>)
endfunction()