summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/FindPackageModeMakefileTest/CMakeLists.txt22
-rw-r--r--Tests/FindPackageModeMakefileTest/Makefile.in8
-rw-r--r--Tests/FindPackageModeMakefileTest/main.cpp8
4 files changed, 40 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2ad9a77..a75b3df 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -46,6 +46,8 @@ IF(BUILD_TESTING)
ADD_SUBDIRECTORY(CMakeLib)
+ ADD_SUBDIRECTORY(FindPackageModeMakefileTest)
+
# Collect a list of all test build directories.
SET(TEST_BUILD_DIRS)
diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt
new file mode 100644
index 0000000..0be3783
--- /dev/null
+++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt
@@ -0,0 +1,22 @@
+
+if("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES XL
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro)
+
+ find_package(PNG)
+
+ # the test program links against the png lib, so test first whether it exists
+ if(PNG_FOUND)
+
+ get_target_property(cmakeExecutable cmake LOCATION)
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY)
+
+ add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile -C ${CMAKE_CURRENT_BINARY_DIR} )
+
+ endif()
+
+endif()
diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in
new file mode 100644
index 0000000..5105d99
--- /dev/null
+++ b/Tests/FindPackageModeMakefileTest/Makefile.in
@@ -0,0 +1,8 @@
+all: clean pngtest
+
+pngtest: main.o
+ "@CMAKE_CXX_COMPILER@" -c `"@cmakeExecutable@" --find-package -DNAME=PNG -DLANGUAGE=CXX -DCOMPILER_ID=@CMAKE_CXX_COMPILER_ID@ -DMODE=COMPILE` main.cpp
+ "@CMAKE_CXX_COMPILER@" -o pngtest main.o `"@cmakeExecutable@" --find-package -DNAME=PNG -DLANGUAGE=CXX -DCOMPILER_ID=@CMAKE_CXX_COMPILER_ID@ -DMODE=LINK`
+
+clean:
+ rm -f *.o pngtest
diff --git a/Tests/FindPackageModeMakefileTest/main.cpp b/Tests/FindPackageModeMakefileTest/main.cpp
new file mode 100644
index 0000000..b785427
--- /dev/null
+++ b/Tests/FindPackageModeMakefileTest/main.cpp
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <png.h>
+
+int main()
+{
+ printf("PNG copyright: %s\n", png_get_copyright(NULL));
+ return 0;
+}