mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 12:49:36 -06:00
Document and add explicit tests for empty string input:
`if(EXISTS "")` and `if(IS_DIRECTORY "")` are always false.
This avoids need for users to do extra checks due to
CMake non-short-circuit logic as below:
if("${p}")
if(EXISTS "${p}")
14 lines
377 B
CMake
14 lines
377 B
CMake
set(d "/long/path/to/directory")
|
|
foreach(i RANGE 11)
|
|
string(APPEND d "${d}")
|
|
endforeach()
|
|
string(LENGTH "${d}" dl)
|
|
if(IS_DIRECTORY "${d}/")
|
|
message(FATAL_ERROR "Directory should not exist!")
|
|
else()
|
|
message(STATUS "Directory path with length ${dl} correctly does not exist.")
|
|
endif()
|
|
if(IS_DIRECTORY "")
|
|
message(FATAL_ERROR "IS_DIRECTORY \"\" should not exist")
|
|
endif()
|