diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-08-11 21:27:19 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-08-11 21:34:17 (GMT) |
commit | 9fc87c6343a5d448f04d7a9397beb95e3b85178e (patch) | |
tree | be1510dea7a80fb25dcc94d9ddc467d86187edc4 | |
parent | d3ae0fff7dea00775f8c6e8bed59a494f102999c (diff) | |
download | CMake-9fc87c6343a5d448f04d7a9397beb95e3b85178e.zip CMake-9fc87c6343a5d448f04d7a9397beb95e3b85178e.tar.gz CMake-9fc87c6343a5d448f04d7a9397beb95e3b85178e.tar.bz2 |
Add a test for the new --find-package mode
Alex
-rw-r--r-- | Tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/Makefile.in | 8 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/main.cpp | 8 |
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; +} |