add_test: CROSSCOMPILING_EMULATOR is used even CMAKE_CROSSCOMPILING is off
Steps to reproduce
- Host OS: Windows 10
- CMake: 3.23.2
cmake_minimum_required(VERSION 3.23)
project(CMakeTest)
if(CMAKE_CROSSCOMPILING)
message(FATAL_ERROR "cross compiling")
endif()
add_executable(app main.cpp)
enable_testing()
add_test(NAME App COMMAND app)
Configure with -DCMAKE_CROSSCOMPILING_EMULATOR=no-such-cmd
and then run ctest
:
Unable to find executable: no-such-cmd
1/1 Test #1: App ..............................***Not Run 0.00 sec
References
Edited by Brad King