Tests: Add test for CMAKE_DEPENDS_IN_PROJECT_ONLY variable
This commit is contained in:
parent
b1e1aa1e6a
commit
525402450a
|
@ -0,0 +1,2 @@
|
||||||
|
#include <MakeInProjectOnly.h>
|
||||||
|
int main() { return MakeInProjectOnly(); }
|
|
@ -0,0 +1,16 @@
|
||||||
|
enable_language(C)
|
||||||
|
get_filename_component(include_dir "${CMAKE_BINARY_DIR}" PATH)
|
||||||
|
include_directories("${include_dir}")
|
||||||
|
add_executable(MakeInProjectOnly MakeInProjectOnly.c)
|
||||||
|
set(CMAKE_DEPENDS_IN_PROJECT_ONLY 1)
|
||||||
|
file(GENERATE OUTPUT check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
|
||||||
|
if (check_step EQUAL 1)
|
||||||
|
set(check_pairs
|
||||||
|
\"$<TARGET_FILE:MakeInProjectOnly>|${include_dir}/MakeInProjectOnly.h\"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(check_pairs
|
||||||
|
\"${include_dir}/MakeInProjectOnly.h|\$<TARGET_FILE:MakeInProjectOnly>\"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
")
|
|
@ -0,0 +1,3 @@
|
||||||
|
file(WRITE "${RunCMake_TEST_BINARY_DIR}/../MakeInProjectOnly.h" [[
|
||||||
|
int MakeInProjectOnly(void) { return 0; }
|
||||||
|
]])
|
|
@ -0,0 +1,3 @@
|
||||||
|
file(WRITE "${RunCMake_TEST_BINARY_DIR}/../MakeInProjectOnly.h" [[
|
||||||
|
int MakeInProjectOnly(void) { return 1; }
|
||||||
|
]])
|
|
@ -41,6 +41,11 @@ endif()
|
||||||
|
|
||||||
run_BuildDepends(Custom-Always)
|
run_BuildDepends(Custom-Always)
|
||||||
|
|
||||||
|
if(RunCMake_GENERATOR MATCHES "Make" AND
|
||||||
|
NOT "${RunCMake_BINARY_DIR}" STREQUAL "${RunCMake_SOURCE_DIR}")
|
||||||
|
run_BuildDepends(MakeInProjectOnly)
|
||||||
|
endif()
|
||||||
|
|
||||||
function(run_ReGeneration)
|
function(run_ReGeneration)
|
||||||
# test re-generation of project even if CMakeLists.txt files disappeared
|
# test re-generation of project even if CMakeLists.txt files disappeared
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue