diff options
author | James Johnston <johnstonj.public@codenest.com> | 2015-08-18 03:55:38 (GMT) |
---|---|---|
committer | James Johnston <johnstonj.public@codenest.com> | 2015-08-18 03:55:38 (GMT) |
commit | e89ea3d190492e41b37425ff021311c2b471f1b9 (patch) | |
tree | 35c88e18b8ac49fc2f115140c73ba04b8df3f0a1 /Tests/RunCMake/get_filename_component | |
parent | a38ea312c02eec6e4ee61015f70920999bf79ff9 (diff) | |
download | CMake-e89ea3d190492e41b37425ff021311c2b471f1b9.zip CMake-e89ea3d190492e41b37425ff021311c2b471f1b9.tar.gz CMake-e89ea3d190492e41b37425ff021311c2b471f1b9.tar.bz2 |
get_filename_component: Teach new BASE_DIR parameter.
In the get_filename_component command, add a new BASE_DIR parameter to
use with the ABSOLUTE and REALPATH options. This will be used when
finding an absolute path from a relative path.
Diffstat (limited to 'Tests/RunCMake/get_filename_component')
-rw-r--r-- | Tests/RunCMake/get_filename_component/KnownComponents.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/get_filename_component/KnownComponents.cmake b/Tests/RunCMake/get_filename_component/KnownComponents.cmake index 386109f..d822258 100644 --- a/Tests/RunCMake/get_filename_component/KnownComponents.cmake +++ b/Tests/RunCMake/get_filename_component/KnownComponents.cmake @@ -38,6 +38,39 @@ check("ABSOLUTE .. in windows root" "${test_absolute}" "c:/path/to/filename.ext. list(APPEND non_cache_vars test_absolute) +# Test finding absolute paths from various base directories. + +get_filename_component(test_abs_base "testdir1" ABSOLUTE) +check("ABSOLUTE .. from default base" "${test_abs_base}" + "${CMAKE_CURRENT_SOURCE_DIR}/testdir1") + +get_filename_component(test_abs_base "../testdir2" ABSOLUTE + BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dummydir") +check("ABSOLUTE .. from dummy base to parent" "${test_abs_base}" + "${CMAKE_CURRENT_SOURCE_DIR}/testdir2") + +get_filename_component(test_abs_base "testdir3" ABSOLUTE + BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dummydir") +check("ABSOLUTE .. from dummy base to child" "${test_abs_base}" + "${CMAKE_CURRENT_SOURCE_DIR}/dummydir/testdir3") + +list(APPEND non_cache_vars test_abs_base) + +# Test finding absolute paths with CACHE parameter. (Note that more +# rigorous testing of the CACHE parameter comes later with PROGRAM). + +get_filename_component(test_abs_base_1 "testdir4" ABSOLUTE CACHE) +check("ABSOLUTE CACHE 1" "${test_abs_base_1}" + "${CMAKE_CURRENT_SOURCE_DIR}/testdir4") +list(APPEND cache_vars test_abs_base_1) + +get_filename_component(test_abs_base_2 "testdir5" ABSOLUTE + BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dummydir" + CACHE) +check("ABSOLUTE CACHE 2" "${test_abs_base_2}" + "${CMAKE_CURRENT_SOURCE_DIR}/dummydir/testdir5") +list(APPEND cache_vars test_abs_base_2) + # Test the PROGRAM component type. get_filename_component(test_program_name "/ arg1 arg2" PROGRAM) check("PROGRAM with no args output" "${test_program_name}" "/") |