include(RunCMake)

file(WRITE "${RunCMake_BINARY_DIR}/file.txt" "")
file(CHMOD "${RunCMake_BINARY_DIR}/file.txt" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)

set(options -DRELATIVE_PATH=relative -DABSOLUTE_PATH=/absolute
  -DRELATIVE_PATH_WITH_TYPE:PATH=relative -DABSOLUTE_PATH_WITH_TYPE:PATH=/absolute
  -DNOTFOUND_PATH=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE:PATH=NOTFOUND
  -DFILE_NAME=file2.txt -DFILE_NAME_WITH_TYPE:PATH=file2.txt
  -DSEARCH_NAME=file.txt "-DSEARCH_PATH=${RunCMake_BINARY_DIR}"
  -DRELATIVE_PATH_AND_LOCAL=relative -DABSOLUTE_PATH_AND_LOCAL=/absolute
  -DRELATIVE_PATH_WITH_TYPE_AND_LOCAL:PATH=relative -DABSOLUTE_PATH_WITH_TYPE_AND_LOCAL:PATH=/absolute
  -DNOTFOUND_PATH_AND_LOCAL=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE_AND_LOCAL:PATH=NOTFOUND
  -DFILE_NAME=file2.txt -DFILE_NAME_WITH_TYPE:PATH=file2.txt
  -DSEARCH_NAME=file.txt "-DSEARCH_PATH=${RunCMake_BINARY_DIR}")

run_cmake_with_options(CMP0125-find_file-OLD ${options})
run_cmake_with_options(CMP0125-find_file-NEW ${options})
run_cmake_with_options(CMP0125-find_path-OLD ${options})
run_cmake_with_options(CMP0125-find_path-NEW ${options})
run_cmake_with_options(CMP0125-find_program-OLD ${options})
run_cmake_with_options(CMP0125-find_program-NEW ${options})


file(WRITE "${RunCMake_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}file${CMAKE_SHARED_LIBRARY_SUFFIX}" "")
file(CHMOD "${RunCMake_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}file${CMAKE_SHARED_LIBRARY_SUFFIX}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)

set(options -DRELATIVE_PATH=relative -DABSOLUTE_PATH=/absolute
  -DRELATIVE_PATH_WITH_TYPE:PATH=relative -DABSOLUTE_PATH_WITH_TYPE:PATH=/absolute
  -DNOTFOUND_PATH=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE:PATH=NOTFOUND
  -DFILE_NAME=${CMAKE_SHARED_LIBRARY_PREFIX}file2${CMAKE_SHARED_LIBRARY_SUFFIX}
  -DFILE_NAME_WITH_TYPE:PATH=${CMAKE_SHARED_LIBRARY_PREFIX}file2${CMAKE_SHARED_LIBRARY_SUFFIX}
  -DSEARCH_NAME=file "-DSEARCH_PATH=${RunCMake_BINARY_DIR}")

run_cmake_with_options(CMP0125-find_library-OLD ${options})
run_cmake_with_options(CMP0125-find_library-NEW ${options})
