[Cmake-commits] CMake branch, next, updated. v2.8.5-1566-gabb7bb9

Alexander Neundorf neundorf at kde.org
Tue Aug 16 16:28:03 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  abb7bb9cbb0b80af8a4b9788c34fb408996b0f64 (commit)
       via  626fc717c6a6fb880053e645b3f12805f60c102a (commit)
      from  f9239a25c33d6b099d706645ffa3661a922d57fb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=abb7bb9cbb0b80af8a4b9788c34fb408996b0f64
commit abb7bb9cbb0b80af8a4b9788c34fb408996b0f64
Merge: f9239a2 626fc71
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Tue Aug 16 16:28:01 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Aug 16 16:28:01 2011 -0400

    Merge topic 'UsingCMakeLikePkgConfig2' into next
    
    626fc71 Much improved test, should now be executed on all UNIXes


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=626fc717c6a6fb880053e645b3f12805f60c102a
commit 626fc717c6a6fb880053e645b3f12805f60c102a
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Tue Aug 16 22:31:26 2011 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Tue Aug 16 22:31:26 2011 +0200

    Much improved test, should now be executed on all UNIXes
    
    Instead of relying on that some development package is installed on the
    system, now a tiny library is built, which is the searched and used
    during the test.
    
    Alex

diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt
index d2c6be9..17f02b4 100644
--- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt
+++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt
@@ -1,22 +1,20 @@
 
-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(UNIX  AND  "${CMAKE_GENERATOR}" MATCHES "Makefile")
 
-  # the test program links against the png lib, so test first whether it exists
-  if(PNG_FOUND  AND  UNIX  AND  "${CMAKE_GENERATOR}" MATCHES "Makefile")
+  # build a library which we can search during the test
+  add_library(foo STATIC foo.cpp)
 
-    get_target_property(cmakeExecutable cmake LOCATION)
+  # 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)
 
-    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)
+  # now set up the test:
+  get_target_property(cmakeExecutable cmake LOCATION)
 
-    add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile )
+  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)
 
-  endif()
+  add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile )
 
 endif()
diff --git a/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in b/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in
new file mode 100644
index 0000000..c6230ab
--- /dev/null
+++ b/Tests/FindPackageModeMakefileTest/FindFoo.cmake.in
@@ -0,0 +1,8 @@
+
+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})
+
+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
index 5e42305..6bcd9b6 100644
--- a/Tests/FindPackageModeMakefileTest/Makefile.in
+++ b/Tests/FindPackageModeMakefileTest/Makefile.in
@@ -1,10 +1,10 @@
 all: clean pngtest
 
 main.o: main.cpp
-	"@CMAKE_CXX_COMPILER@" -c `"@cmakeExecutable@" --find-package -DNAME=PNG -DLANGUAGE=CXX -DCOMPILER_ID=@CMAKE_CXX_COMPILER_ID@ -DMODE=COMPILE` main.cpp
+	"@CMAKE_CXX_COMPILER@" -c `"@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@" -o pngtest main.o `"@cmakeExecutable@" --find-package -DNAME=PNG -DLANGUAGE=CXX -DCOMPILER_ID=@CMAKE_CXX_COMPILER_ID@ -DMODE=LINK`
+	"@CMAKE_CXX_COMPILER@" -o pngtest main.o `"@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
index b785427..e5f9134 100644
--- a/Tests/FindPackageModeMakefileTest/main.cpp
+++ b/Tests/FindPackageModeMakefileTest/main.cpp
@@ -1,8 +1,8 @@
 #include <stdio.h>
-#include <png.h>
+#include <foo.h>
 
 int main()
 {
- printf("PNG copyright: %s\n", png_get_copyright(NULL));
+ printf("foo is: %d\n", foo());
  return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 Tests/FindPackageModeMakefileTest/CMakeLists.txt   |   24 +++++++++----------
 Tests/FindPackageModeMakefileTest/FindFoo.cmake.in |    8 ++++++
 Tests/FindPackageModeMakefileTest/Makefile.in      |    4 +-
 .../foo.cpp}                                       |    2 +-
 Tests/FindPackageModeMakefileTest/foo.h            |    6 +++++
 Tests/FindPackageModeMakefileTest/main.cpp         |    4 +-
 6 files changed, 30 insertions(+), 18 deletions(-)
 create mode 100644 Tests/FindPackageModeMakefileTest/FindFoo.cmake.in
 copy Tests/{SourceGroups/sub1/foobar.c => FindPackageModeMakefileTest/foo.cpp} (52%)
 create mode 100644 Tests/FindPackageModeMakefileTest/foo.h


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list