Updates will be applied today, at 4 pm EDT (UTC-0400). No interruption, and site should remain available.

Commit 9fc87c63 authored by Alexander Neundorf's avatar Alexander Neundorf

Add a test for the new --find-package mode

Alex
parent d3ae0fff
......@@ -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)
......
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()
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
#include <stdio.h>
#include <png.h>
int main()
{
printf("PNG copyright: %s\n", png_get_copyright(NULL));
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment