parent
d3ae0fff7d
commit
9fc87c6343
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
#include <stdio.h>
|
||||
#include <png.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("PNG copyright: %s\n", png_get_copyright(NULL));
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue