diff options
author | David Cole <david.cole@kitware.com> | 2011-08-25 19:40:49 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-08-25 19:40:49 (GMT) |
commit | 28cba226b352e04c96441f8ca051edf98c68994e (patch) | |
tree | c05a39ab6389f588dcb0b5ef0b9d864753ca6555 /Tests | |
parent | f5115f91d974e866b21a7c65386fcda34221e6bf (diff) | |
parent | 59238dc2deb80f3f3d101de9a3945f890981a2c0 (diff) | |
download | CMake-28cba226b352e04c96441f8ca051edf98c68994e.zip CMake-28cba226b352e04c96441f8ca051edf98c68994e.tar.gz CMake-28cba226b352e04c96441f8ca051edf98c68994e.tar.bz2 |
Merge topic 'UsingCMakeLikePkgConfig2'
59238dc Fix --find-package mode on Cygwin, where enable_language(RC) is called
98472e4 Require the current cmake version in --find-package mode
a6ccf3c Use $(CXXFLAGS) and $(LDFLAGS) in the --find-package test Makefile
4386918 Fix line length
7d69310 Only enable the test when using GNU make
3011149 Make the test harder by always having a space in the include dirs
ab57ff6 Make the --find-package test harder
626fc71 Much improved test, should now be executed on all UNIXes
ec6982d Disable any STATUS output in --find-package mode
e552ae7 Dont check for -isysroot and -mmacosx-version on OSX in --find-package mode
e589589 Rename helper macros print_compile_flags() to set_compile_flags_var()
aecfc1f Fix test on OpenBSD with BSD make
6bb4ca3 The makefile for the test was kindof wrong
fd15b5e Only run the test if we are using a makefile generator under UNIX
9fc87c6 Add a test for the new --find-package mode
d3ae0ff Improve documentation for --find-package mode
bf07375 Add a cmake.m4 for using cmake in autoconf projects instead of pkgconfig
b0e3578 Use the file-utility to test for 64bit if there is no /usr/lib64
53edfb2 Better support for lib64 and Debian multiarch
b8fdaa1 Fix copyright notice in new CMakeFindPackageMode.cmake
7690edf Replace cmake::GetScriptMode() with GetWorkingMode()
e4f603b Implement find-package mode of cmake
a91d662 Add find-package mode, which does nothing yet
b976e70 Make clLocalGenerator::GetTargetFlags() public
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 30 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/FindFoo.cmake.in | 9 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/Makefile.in | 10 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/foo.cpp | 4 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/foo.h | 6 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/main.cpp | 8 |
7 files changed, 69 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cfc1846..46b3c15 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -48,6 +48,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..def8d63 --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -0,0 +1,30 @@ + + +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") + + # Test whether the make is GNU make, and only add the test in this case, + # since the configured makefile in this test uses $(shell ...), which + # is AFAIK a GNU make extension. Alex + execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -v + OUTPUT_VARIABLE makeVersionOutput + TIMEOUT 10) + string(TOUPPER "${makeVersionOutput}" MAKE_VERSION_OUTPUT) + if("${MAKE_VERSION_OUTPUT}" MATCHES ".*GNU MAKE.*") + + # build a library which we can search during the test + add_library(foo STATIC foo.cpp) + + # configure a FindFoo.cmake so it knows where the library can be found + configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY) + + # now set up the test: + 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 ) + + endif() + +endif() diff --git a/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in b/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in new file mode 100644 index 0000000..dc62bac --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in @@ -0,0 +1,9 @@ + +find_library(FOO_LIBRARY NAMES foo HINTS "@CMAKE_CURRENT_BINARY_DIR@" ) +find_path(FOO_INCLUDE_DIR NAMES foo.h HINTS "@CMAKE_CURRENT_SOURCE_DIR@" ) + +set(FOO_LIBRARIES ${FOO_LIBRARY}) +set(FOO_INCLUDE_DIRS "${FOO_INCLUDE_DIR}" "/some/path/with a space/include" ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Foo DEFAULT_MSG FOO_LIBRARY FOO_INCLUDE_DIR ) diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in new file mode 100644 index 0000000..073d82e --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -0,0 +1,10 @@ +all: clean pngtest + +main.o: main.cpp + "@CMAKE_CXX_COMPILER@" $(CXXFLAGS) -c $(shell "@cmakeExecutable@" --find-package -DCMAKE_MODULE_PATH="@CMAKE_CURRENT_BINARY_DIR@" -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=@CMAKE_CXX_COMPILER_ID@ -DMODE=COMPILE) main.cpp + +pngtest: main.o + "@CMAKE_CXX_COMPILER@" $(LDFLAGS) -o pngtest main.o $(shell "@cmakeExecutable@" --find-package -DCMAKE_MODULE_PATH="@CMAKE_CURRENT_BINARY_DIR@" -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=@CMAKE_CXX_COMPILER_ID@ -DMODE=LINK) + +clean: + rm -f *.o pngtest diff --git a/Tests/FindPackageModeMakefileTest/foo.cpp b/Tests/FindPackageModeMakefileTest/foo.cpp new file mode 100644 index 0000000..6aea226 --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/foo.cpp @@ -0,0 +1,4 @@ +int foo() +{ + return 1477; +} diff --git a/Tests/FindPackageModeMakefileTest/foo.h b/Tests/FindPackageModeMakefileTest/foo.h new file mode 100644 index 0000000..4ec598a --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/foo.h @@ -0,0 +1,6 @@ +#ifndef FOO_H +#define FOO_H + +int foo(); + +#endif diff --git a/Tests/FindPackageModeMakefileTest/main.cpp b/Tests/FindPackageModeMakefileTest/main.cpp new file mode 100644 index 0000000..e5f9134 --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/main.cpp @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <foo.h> + +int main() +{ + printf("foo is: %d\n", foo()); + return 0; +} |