summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt13
-rw-r--r--Tests/FindPackageTest/Exporter/CMakeLists.txt12
-rw-r--r--Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in1
-rw-r--r--Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in6
-rw-r--r--Tests/FindPackageTest/Exporter/dummy.c1
5 files changed, 33 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index f82f4a1..a62756e 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -180,3 +180,16 @@ ENDIF()
IF(NOT "1.2" VERSION_EQUAL "1.2.0.0")
MESSAGE(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
ENDIF()
+
+#-----------------------------------------------------------------------------
+# Test export(PACKAGE) with find_package.
+MESSAGE(STATUS "Preparing export(PACKAGE) test project")
+TRY_COMPILE(EXPORTER_COMPILED
+ ${FindPackageTest_BINARY_DIR}/Exporter
+ ${FindPackageTest_SOURCE_DIR}/Exporter
+ CMakeTestExportPackage dummy
+ OUTPUT_VARIABLE output)
+MESSAGE(STATUS "Searching for export(PACKAGE) test project")
+SET(CMakeTestExportPackage_DIR "" CACHE FILEPATH
+ "Wipe out find results for testing." FORCE)
+FIND_PACKAGE(CMakeTestExportPackage 1.${CMAKE_VERSION} EXACT REQUIRED)
diff --git a/Tests/FindPackageTest/Exporter/CMakeLists.txt b/Tests/FindPackageTest/Exporter/CMakeLists.txt
new file mode 100644
index 0000000..d25a2e7
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.7.20090831)
+project(CMakeTestExportPackage C)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeTestExportPackageConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTestExportPackageConfig.cmake
+ @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeTestExportPackageConfigVersion.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTestExportPackageConfigVersion.cmake
+ @ONLY)
+export(PACKAGE CMakeTestExportPackage)
+
+add_executable(dummy dummy.c)
diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in
new file mode 100644
index 0000000..deffa57
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
new file mode 100644
index 0000000..ff450a1
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
@@ -0,0 +1,6 @@
+# Test config file.
+SET(PACKAGE_VERSION "1.@CMAKE_VERSION@")
+IF("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ SET(PACKAGE_VERSION_EXACT 1)
+ENDIF()
diff --git a/Tests/FindPackageTest/Exporter/dummy.c b/Tests/FindPackageTest/Exporter/dummy.c
new file mode 100644
index 0000000..76e8197
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/dummy.c
@@ -0,0 +1 @@
+int main() { return 0; }