summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPackInstallProperties
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2014-05-15 17:12:40 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-28 16:28:18 (GMT)
commit15a8af21e8bd8354dfff2063e01f695f85efdeb8 (patch)
treeb7d98cab3ba63f61074a4f63a250934f0294826a /Tests/RunCMake/CPackInstallProperties
parent032961c6ac81d82270a7b1986935111aa5e32a56 (diff)
downloadCMake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.zip
CMake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.tar.gz
CMake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.tar.bz2
Add an "installed file" property scope
Teach set_property and get_property an "INSTALL" property type to be associated with install-tree file paths. Make the properties available to CPack for use during packaging. Add a "prop_inst" Sphinx domain object type for documentation of such properties.
Diffstat (limited to 'Tests/RunCMake/CPackInstallProperties')
-rw-r--r--Tests/RunCMake/CPackInstallProperties/Append-check.cmake3
-rw-r--r--Tests/RunCMake/CPackInstallProperties/Append.cmake2
-rw-r--r--Tests/RunCMake/CPackInstallProperties/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake3
-rw-r--r--Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake7
-rw-r--r--Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake3
-rw-r--r--Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake1
-rw-r--r--Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake13
-rw-r--r--Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake14
-rw-r--r--Tests/RunCMake/CPackInstallProperties/Replace-check.cmake3
-rw-r--r--Tests/RunCMake/CPackInstallProperties/Replace.cmake2
-rw-r--r--Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/CPackInstallProperties/Simple-check.cmake3
-rw-r--r--Tests/RunCMake/CPackInstallProperties/Simple.cmake1
-rw-r--r--Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake3
-rw-r--r--Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake7
-rw-r--r--Tests/RunCMake/CPackInstallProperties/check.cmake12
-rw-r--r--Tests/RunCMake/CPackInstallProperties/test.cpp1
18 files changed, 93 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPackInstallProperties/Append-check.cmake b/Tests/RunCMake/CPackInstallProperties/Append-check.cmake
new file mode 100644
index 0000000..017b30d
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/Append-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_property("append.txt" CPACK_TEST_PROP "value1;value2;value3")
diff --git a/Tests/RunCMake/CPackInstallProperties/Append.cmake b/Tests/RunCMake/CPackInstallProperties/Append.cmake
new file mode 100644
index 0000000..cecc45f
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/Append.cmake
@@ -0,0 +1,2 @@
+set_property(INSTALL append.txt PROPERTY CPACK_TEST_PROP value1)
+set_property(INSTALL append.txt PROPERTY CPACK_TEST_PROP value2 value3 APPEND)
diff --git a/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt b/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt
new file mode 100644
index 0000000..89ff7c4
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.0)
+
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
+
+include(CPack)
diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake
new file mode 100644
index 0000000..8c9e967
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_property(${EXPECTED_MYTEST_NAME} CPACK_TEST_PROP2 PROP_VALUE2)
diff --git a/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake
new file mode 100644
index 0000000..1a373b9
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/FilenameGenex.cmake
@@ -0,0 +1,7 @@
+add_executable(mytest test.cpp)
+
+file(GENERATE OUTPUT runtest_info.cmake CONTENT [[
+set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>")
+]])
+
+set_property(INSTALL $<TARGET_FILE_NAME:mytest> PROPERTY CPACK_TEST_PROP2 PROP_VALUE2)
diff --git a/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake b/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake
new file mode 100644
index 0000000..91278ba
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/MultipleValues-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_property("multiple_values.txt" CPACK_TEST_PROP "value1;value2;value3")
diff --git a/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake b/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake
new file mode 100644
index 0000000..26db52a
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/MultipleValues.cmake
@@ -0,0 +1 @@
+set_property(INSTALL multiple_values.txt PROPERTY CPACK_TEST_PROP value1 value2 value3)
diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake
new file mode 100644
index 0000000..2966d88
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue-check.cmake
@@ -0,0 +1,13 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+file(GLOB INFO_FILES ${RunCMake_TEST_BINARY_DIR}/runtest_info_*.cmake)
+
+if(NOT INFO_FILES)
+ message(FATAL_ERROR "missing expected info files")
+endif()
+
+foreach(INFO_FILE IN LISTS INFO_FILES)
+ include(${INFO_FILE})
+ include(${RunCMake_TEST_BINARY_DIR}/CPackProperties.cmake)
+ test_property("config.cpp" FOO ${EXPECTED_MYTEST_NAME})
+endforeach()
diff --git a/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake
new file mode 100644
index 0000000..77fe8ed
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/PerConfigValue.cmake
@@ -0,0 +1,14 @@
+add_executable(mytest test.cpp)
+
+foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES)
+ string(TOUPPER ${CONFIG} UPPER_CONFIG)
+ set_property(TARGET mytest PROPERTY
+ OUTPUT_NAME_${UPPER_CONFIG} bar_${CONFIG})
+endforeach()
+
+file(GENERATE OUTPUT runtest_info_$<CONFIG>.cmake CONTENT [[
+set(CPACK_BUILD_CONFIG "$<CONFIG>")
+set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>")
+]])
+
+set_property(INSTALL config.cpp PROPERTY FOO $<TARGET_FILE_NAME:mytest>)
diff --git a/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake b/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake
new file mode 100644
index 0000000..6e492e7
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/Replace-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_property("replace.txt" CPACK_TEST_PROP "value2")
diff --git a/Tests/RunCMake/CPackInstallProperties/Replace.cmake b/Tests/RunCMake/CPackInstallProperties/Replace.cmake
new file mode 100644
index 0000000..104d5a4
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/Replace.cmake
@@ -0,0 +1,2 @@
+set_property(INSTALL replace.txt PROPERTY CPACK_TEST_PROP value1)
+set_property(INSTALL replace.txt PROPERTY CPACK_TEST_PROP value2)
diff --git a/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake b/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake
new file mode 100644
index 0000000..d244ac5
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(Simple)
+run_cmake(FilenameGenex)
+run_cmake(ValueGenex)
+run_cmake(MultipleValues)
+run_cmake(Append)
+run_cmake(Replace)
+run_cmake(PerConfigValue)
diff --git a/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake b/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake
new file mode 100644
index 0000000..6a7ee2a
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/Simple-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_property("foo/test.cpp" CPACK_TEST_PROP PROP_VALUE)
diff --git a/Tests/RunCMake/CPackInstallProperties/Simple.cmake b/Tests/RunCMake/CPackInstallProperties/Simple.cmake
new file mode 100644
index 0000000..2eb8755
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/Simple.cmake
@@ -0,0 +1 @@
+set_property(INSTALL foo/test.cpp PROPERTY CPACK_TEST_PROP PROP_VALUE)
diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake
new file mode 100644
index 0000000..cdfbcda
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex-check.cmake
@@ -0,0 +1,3 @@
+include(${RunCMake_SOURCE_DIR}/check.cmake)
+
+test_property("bar/test.cpp" CPACK_TEST_PROP ${EXPECTED_MYTEST_NAME})
diff --git a/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake
new file mode 100644
index 0000000..2e1d465
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/ValueGenex.cmake
@@ -0,0 +1,7 @@
+add_executable(mytest test.cpp)
+
+file(GENERATE OUTPUT runtest_info.cmake CONTENT [[
+set(EXPECTED_MYTEST_NAME "$<TARGET_FILE_NAME:mytest>")
+]])
+
+set_property(INSTALL bar/test.cpp PROPERTY CPACK_TEST_PROP $<TARGET_FILE_NAME:mytest>)
diff --git a/Tests/RunCMake/CPackInstallProperties/check.cmake b/Tests/RunCMake/CPackInstallProperties/check.cmake
new file mode 100644
index 0000000..65aa467
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/check.cmake
@@ -0,0 +1,12 @@
+function(test_property FILE NAME EXPECTED_VALUE)
+ get_property(ACTUAL_VALUE INSTALL "${FILE}" PROPERTY "${NAME}")
+
+ if(NOT "${ACTUAL_VALUE}" STREQUAL "${EXPECTED_VALUE}")
+ message(FATAL_ERROR "${NAME}@${FILE}: property mismatch expected [${EXPECTED_VALUE}] actual [${ACTUAL_VALUE}] (Config:${CPACK_BUILD_CONFIG})")
+ endif()
+endfunction()
+
+set(CPACK_BUILD_CONFIG Debug)
+include(${RunCMake_TEST_BINARY_DIR}/CPackProperties.cmake)
+
+include(${RunCMake_TEST_BINARY_DIR}/runtest_info.cmake OPTIONAL)
diff --git a/Tests/RunCMake/CPackInstallProperties/test.cpp b/Tests/RunCMake/CPackInstallProperties/test.cpp
new file mode 100644
index 0000000..237c8ce
--- /dev/null
+++ b/Tests/RunCMake/CPackInstallProperties/test.cpp
@@ -0,0 +1 @@
+int main() {}