| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- find_program(PROG_A
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (DEFINED CACHE{PROG_A})
- message(SEND_ERROR "Cache variable defined: PROG_A")
- endif()
- message(STATUS "PROG_A='${PROG_A}'")
- find_program(PROG_AandB
- NAMES testAandB
- NO_CACHE
- )
- if (DEFINED CACHE{PROG_AandB})
- message(SEND_ERROR "Cache variable defined: PROG_AandN")
- endif()
- message(STATUS "PROG_AandB='${PROG_AandB}'")
- cmake_policy(SET CMP0125 OLD)
- message(STATUS "")
- message(STATUS "Policy CMP0125 = OLD")
- file(REMOVE "${CMAKE_BINARY_DIR}/testA")
- set(PROG_cache "unknown" CACHE FILEPATH "")
- find_program(PROG_cache
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (NOT DEFINED CACHE{PROG_cache})
- message(SEND_ERROR "Cache variable not defined: PROG_cache")
- endif()
- message(STATUS "CACHED PROG_cache='$CACHE{PROG_cache}'")
- unset(PROG_cache CACHE)
- message(STATUS "PROG_cache='${PROG_cache}'")
- set(PROG_cache "testA" CACHE FILEPATH "")
- unset(PROG_cache)
- find_program(PROG_cache
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (NOT DEFINED CACHE{PROG_cache})
- message(SEND_ERROR "Cache variable not defined: PROG_cache")
- endif()
- message(STATUS "CACHED PROG_cache='$CACHE{PROG_cache}'")
- unset(PROG_cache CACHE)
- message(STATUS "PROG_cache='${PROG_cache}'")
- set(PROG_cache "testA" CACHE FILEPATH "")
- unset(PROG_cache)
- # simulate cache variable defined in command line
- file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/A/testA" DESTINATION "${CMAKE_BINARY_DIR}")
- set_property(CACHE PROG_cache PROPERTY TYPE UNINITIALIZED)
- find_program(PROG_cache
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (NOT DEFINED CACHE{PROG_cache})
- message(SEND_ERROR "Cache variable not defined: PROG_cache")
- endif()
- message(STATUS "CACHED PROG_cache='$CACHE{PROG_cache}'")
- unset(PROG_cache CACHE)
- message(STATUS "PROG_cache='${PROG_cache}'")
- cmake_policy(SET CMP0125 NEW)
- message(STATUS "")
- message(STATUS "Policy CMP0125 = NEW")
- file(REMOVE "${CMAKE_BINARY_DIR}/testA")
- set(PROG_cache "unknown" CACHE FILEPATH "")
- find_program(PROG_cache
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (NOT DEFINED CACHE{PROG_cache})
- message(SEND_ERROR "Cache variable not defined: PROG_cache")
- endif()
- message(STATUS "CACHED PROG_cache='$CACHE{PROG_cache}'")
- unset(PROG_cache CACHE)
- message(STATUS "PROG_cache='${PROG_cache}'")
- set(PROG_cache "testA" CACHE FILEPATH "")
- unset(PROG_cache)
- find_program(PROG_cache
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (NOT DEFINED CACHE{PROG_cache})
- message(SEND_ERROR "Cache variable not defined: PROG_cache")
- endif()
- message(STATUS "CACHED PROG_cache='$CACHE{PROG_cache}'")
- unset(PROG_cache CACHE)
- message(STATUS "PROG_cache='${PROG_cache}'")
- set(PROG_cache "testA" CACHE FILEPATH "")
- unset(PROG_cache)
- # simulate cache variable defined in command line
- file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/A/testA" DESTINATION "${CMAKE_BINARY_DIR}")
- set_property(CACHE PROG_cache PROPERTY TYPE UNINITIALIZED)
- find_program(PROG_cache
- NAMES testA
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A
- NO_CACHE
- NO_DEFAULT_PATH
- )
- if (NOT DEFINED CACHE{PROG_cache})
- message(SEND_ERROR "Cache variable not defined: PROG_cache")
- endif()
- message(STATUS "CACHED PROG_cache='$CACHE{PROG_cache}'")
- unset(PROG_cache CACHE)
- message(STATUS "PROG_cache='${PROG_cache}'")
|