CMakeLists.txt 657 B

123456789101112131415161718192021
  1. cmake_minimum_required (VERSION 3.9)
  2. project(TestMissingInstall)
  3. set(CMAKE_SKIP_INSTALL_RULES ON)
  4. # Skip the dependency that causes a build when installing. This
  5. # avoids infinite loops when the post-build rule below installs.
  6. set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
  7. set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
  8. get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
  9. add_executable(mybin mybin.cpp)
  10. install(TARGETS mybin RUNTIME DESTINATION bin)
  11. add_custom_command(TARGET mybin
  12. POST_BUILD
  13. COMMAND ${CMAKE_COMMAND} "-DMULTI_CONFIG=${MULTI_CONFIG}"
  14. -P ${CMAKE_CURRENT_SOURCE_DIR}/ExpectInstallFail.cmake
  15. COMMENT "Install Project"
  16. )