|
|
@@ -132,7 +132,7 @@ project(ExplicitDirsMissing LANGUAGES NONE)
|
|
|
]=])
|
|
|
set(RunCMake_TEST_SOURCE_DIR "${source_dir}")
|
|
|
set(RunCMake_TEST_BINARY_DIR "${source_dir}")
|
|
|
- run_cmake_with_options(no-S-B -DFOO=BAR)
|
|
|
+ run_cmake_with_options(ExplicitDirs-no-S-B -DFOO=BAR)
|
|
|
|
|
|
file(WRITE ${source_dir}/CMakeLists.txt [=[
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
@@ -144,12 +144,12 @@ endif()
|
|
|
|
|
|
file(REMOVE_RECURSE "${source_dir}/build")
|
|
|
# Test with a setup where binary_dir won't be created by `run_cmake_with_options`
|
|
|
- run_cmake_with_options(S-arg-build-dir-not-created -S ${source_dir} build/)
|
|
|
- run_cmake_with_options(S-arg-reverse-build-dir-not-created build/ -S${source_dir} )
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-arg-build-dir-not-created -S ${source_dir} build/)
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-arg-reverse-build-dir-not-created build/ -S${source_dir} )
|
|
|
|
|
|
file(REMOVE_RECURSE "${source_dir}/build")
|
|
|
file(MAKE_DIRECTORY "${source_dir}/build")
|
|
|
- run_cmake_with_options(S-arg-build-dir-empty -S ${source_dir} build/)
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-arg-build-dir-empty -S ${source_dir} build/)
|
|
|
|
|
|
set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
|
|
|
set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
|
|
|
@@ -158,48 +158,48 @@ endif()
|
|
|
set(RunCMake_TEST_BINARY_DIR "${binary_dir}")
|
|
|
|
|
|
file(REMOVE_RECURSE "${binary_dir}")
|
|
|
- run_cmake_with_options(S-arg -S ${source_dir} ${binary_dir})
|
|
|
- run_cmake_with_options(S-arg-reverse-order ${binary_dir} -S${source_dir} )
|
|
|
- run_cmake_with_options(S-no-arg -S )
|
|
|
- run_cmake_with_options(S-no-arg2 -S -T)
|
|
|
- run_cmake_with_raw_args(S-no-arg3 [[-S ""]])
|
|
|
- run_cmake_with_options(S-B -S ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-B-extra-path -S ${source_dir} -B ${binary_dir} /extra/path/)
|
|
|
- run_cmake_with_raw_args(S-B-non-path "-S \"${source_dir}\" -B \"${binary_dir}\" \"\"")
|
|
|
- run_cmake_with_raw_args(S-B-non-path2 "-S \"${source_dir}\" \"\" -B \"${binary_dir}\"")
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-arg -S ${source_dir} ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-arg-reverse-order ${binary_dir} -S${source_dir} )
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-no-arg -S )
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-no-arg2 -S -T)
|
|
|
+ run_cmake_with_raw_args(ExplicitDirs-S-no-arg3 [[-S ""]])
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-B -S ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-B-extra-path -S ${source_dir} -B ${binary_dir} /extra/path/)
|
|
|
+ run_cmake_with_raw_args(ExplicitDirs-S-B-non-path "-S \"${source_dir}\" -B \"${binary_dir}\" \"\"")
|
|
|
+ run_cmake_with_raw_args(ExplicitDirs-S-B-non-path2 "-S \"${source_dir}\" \"\" -B \"${binary_dir}\"")
|
|
|
|
|
|
file(REMOVE_RECURSE "${binary_dir}/other_dir")
|
|
|
file(MAKE_DIRECTORY "${binary_dir}/other_dir")
|
|
|
file(WRITE "${binary_dir}/other_dir/CMakeLists.txt" [=[ ]=])
|
|
|
- run_cmake_with_options(S-S-same -S ${source_dir} -S ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-S-differs -S ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-implicit-same -S ${source_dir} ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-implicit-differs -S ${source_dir} ${binary_dir}/other_dir -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-implicit-differs2 ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-implicit-differs3 ${binary_dir}/other_dir ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-S-Sdiffers -S ${binary_dir}/other_dir1 -S ${binary_dir}/other_dir2 -S ${source_dir} -B ${binary_dir})
|
|
|
- run_cmake_with_options(S-S-Simplicit ${binary_dir}/other_dir1 ${binary_dir}/other_dir2 ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-S-same -S ${source_dir} -S ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-S-differs -S ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-implicit-same -S ${source_dir} ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-implicit-differs -S ${source_dir} ${binary_dir}/other_dir -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-implicit-differs2 ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-implicit-differs3 ${binary_dir}/other_dir ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-S-Sdiffers -S ${binary_dir}/other_dir1 -S ${binary_dir}/other_dir2 -S ${source_dir} -B ${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-S-S-Simplicit ${binary_dir}/other_dir1 ${binary_dir}/other_dir2 ${source_dir} -B ${binary_dir})
|
|
|
|
|
|
# make sure that -B can explicitly construct build directories
|
|
|
file(REMOVE_RECURSE "${binary_dir}")
|
|
|
- run_cmake_with_options(B-arg -B ${binary_dir} ${source_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-B-arg -B ${binary_dir} ${source_dir})
|
|
|
file(REMOVE_RECURSE "${binary_dir}")
|
|
|
- run_cmake_with_options(B-arg-reverse-order ${source_dir} -B${binary_dir})
|
|
|
- run_cmake_with_options(B-no-arg -B )
|
|
|
- run_cmake_with_options(B-no-arg2 -B -T)
|
|
|
- run_cmake_with_raw_args(B-no-arg3 [[-B ""]])
|
|
|
+ run_cmake_with_options(ExplicitDirs-B-arg-reverse-order ${source_dir} -B${binary_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-B-no-arg -B )
|
|
|
+ run_cmake_with_options(ExplicitDirs-B-no-arg2 -B -T)
|
|
|
+ run_cmake_with_raw_args(ExplicitDirs-B-no-arg3 [[-B ""]])
|
|
|
file(REMOVE_RECURSE "${binary_dir}")
|
|
|
- run_cmake_with_options(B-S -B${binary_dir} -S${source_dir})
|
|
|
- run_cmake_with_options(B-S-extra-path -B${binary_dir} -S${source_dir} /extra/path/)
|
|
|
+ run_cmake_with_options(ExplicitDirs-B-S -B${binary_dir} -S${source_dir})
|
|
|
+ run_cmake_with_options(ExplicitDirs-B-S-extra-path -B${binary_dir} -S${source_dir} /extra/path/)
|
|
|
|
|
|
message("copied to ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt")
|
|
|
file(COPY ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt DESTINATION ${RunCMake_TEST_BINARY_DIR})
|
|
|
|
|
|
# CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified.
|
|
|
# Path to initial-cache.txt is relative to the $PWD, which is normally set to ${RunCMake_TEST_BINARY_DIR}.
|
|
|
- run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C initial-cache.txt)
|
|
|
+ run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C initial-cache.txt)
|
|
|
# Test that full path works, too.
|
|
|
- run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
|
|
|
+ run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
|
|
|
endfunction()
|
|
|
run_ExplicitDirs()
|
|
|
|