https://github.com/Kitware/CMake
Raw File
Tip revision: 07d351b535dde56a89aa6786a3f0701e3b159d44 authored by Brad King on 12 April 2022, 13:05:05 UTC
CMake 3.22.4
Tip revision: 07d351b
ExpectInstallFail.cmake
if(MULTI_CONFIG)
  set(SI_CONFIG --config $<CONFIGURATION>)
else()
  set(SI_CONFIG)
endif()

execute_process(
  COMMAND ${CMAKE_COMMAND}
    --build .
    --target install ${SI_CONFIG}
  RESULT_VARIABLE RESULT
  OUTPUT_VARIABLE OUTPUT
  ERROR_VARIABLE ERROR
)

if(RESULT EQUAL 0)
  message(FATAL_ERROR "install should have failed")
endif()
back to top