Boost logo

Boost-Commit :

From: troy_at_[hidden]
Date: 2007-05-20 19:29:30


Author: troy
Date: 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
New Revision: 4151
URL: http://svn.boost.org/trac/boost/changeset/4151

Log:

Tests that link flags propagate correctly from dependency to
dependency: unlike compile flags, they do. You don't have to do
anything special, and the libraries are "sticky". (If cmake builds
lib A, and A takes -lrt on the link line, and you
target_link_libraries(B A), B will automagically get -lrt on its link
line.

These tests probably only work on linux.

Added:
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/e.hpp
Text files modified:
   sandbox/troy/boost_1_34_0/tools/build/CMake/boost-core.cmake | 2 +-
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/CMakeLists.txt | 4 ++--
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/lib.cpp | 13 ++++++++++---
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/CMakeLists.txt | 1 +
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/lib.cpp | 16 ++++++++++++++++
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/CMakeLists.txt | 2 +-
   sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/lib.cpp | 2 +-
   7 files changed, 32 insertions(+), 8 deletions(-)

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/boost-core.cmake
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/boost-core.cmake (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/boost-core.cmake 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -214,7 +214,7 @@
   
 macro(boost_library)
   parse_arguments(THIS_LIB
- "DEPENDS;LIBRARIES;STATIC_COMPILE_FLAGS;STATIC_COMPILE_REQUIREMENTS;STATIC_LINK_FLAGS;STATIC_LINK_REQUIREMENTS;SHARED_COMPILE_FLAGS;SHARED_COMPILE_REQUIREMENTS;SHARED_LINK_FLAGS;SHARED_LINK_REQUIREMENTS"
+ "DEPENDS;LIBRARIES;STATIC_COMPILE_FLAGS;STATIC_COMPILE_REQUIREMENTS;SHARED_COMPILE_FLAGS;SHARED_COMPILE_REQUIREMENTS"
     "NO_STATIC;NO_SHARED;STATIC_TAG"
     ${ARGN}
     )

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/CMakeLists.txt
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/CMakeLists.txt (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/CMakeLists.txt 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -13,8 +13,8 @@
 
   STATIC_COMPILE_REQUIREMENTS "-I${CMAKE_CURRENT_SOURCE_DIR} -DA_COMPILE_REQUIREMENTS -DA_STATIC_COMPILE_REQUIREMENTS"
   SHARED_COMPILE_REQUIREMENTS "-I${CMAKE_CURRENT_SOURCE_DIR} -DA_COMPILE_REQUIREMENTS -DA_SHARED_COMPILE_REQUIREMENTS"
- STATIC_TAG # tds: without STATIC_TAG (append -s to lib name) this fails on darwin.
- # also true for windows?
+ STATIC_TAG # tds: without STATIC_TAG (append -s to lib name) this fails on darwin. also true for windows?
+ LIBRARIES pthread
 )
 
 boost_test_run(test_static DEPENDS a-static)

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/lib.cpp
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/lib.cpp (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/a/lib.cpp 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -5,12 +5,19 @@
 #error A_COMPILE_FLAGS
 #endif
 
+#include <pthread.h>
+
 // dont check (sticky)static/shared here, this gets compiled twice.
 // tests check that things worked right via LINKTYPE
 
 std::string a_linktype() { return BOOST_PP_STRINGIZE(LINKTYPE); }
 
-
-
-
+void a_need_pthread()
+{
+ // this is never called, it just has to compile:
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ int type = 0;
+ pthread_mutexattr_settype(&attr, type);
+}
 

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/CMakeLists.txt
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/CMakeLists.txt (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/CMakeLists.txt 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -10,6 +10,7 @@
   STATIC_COMPILE_REQUIREMENTS "-I${CMAKE_CURRENT_SOURCE_DIR} -DC_COMPILE_REQUIREMENTS -DC_STATIC_COMPILE_REQUIREMENTS"
   SHARED_COMPILE_REQUIREMENTS "-I${CMAKE_CURRENT_SOURCE_DIR} -DC_COMPILE_REQUIREMENTS -DC_SHARED_COMPILE_REQUIREMENTS"
   DEPENDS a
+ LIBRARIES rt
 )
  
 boost_test_run(test_shared DEPENDS c-shared a-shared)

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/lib.cpp
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/lib.cpp (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/c/lib.cpp 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -25,5 +25,21 @@
 
 #include "a.hpp"
 
+#include <time.h>
+
 std::string c_linktype() { a_linktype(); return BOOST_PP_STRINGIZE(LINKTYPE); }
 
+// this one causes a link requirement (-lrt) on linux
+void f()
+{
+ // this is never called, it just has to compile:
+ timespec tp;
+ int res = clock_gettime(CLOCK_REALTIME, &tp);
+ (void) &res;
+}
+
+
+void foo()
+{
+
+}

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/CMakeLists.txt
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/CMakeLists.txt (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/CMakeLists.txt 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -1,6 +1,6 @@
 boost_library_project(
   E
 )
-boost_library(boost_e lib.cpp)
+boost_library(e lib.cpp)
 
 

Added: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/e.hpp
==============================================================================
--- (empty file)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/e.hpp 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -0,0 +1,4 @@
+#include <string>
+
+std::string link_requires_e();
+

Modified: sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/lib.cpp
==============================================================================
--- sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/lib.cpp (original)
+++ sandbox/troy/boost_1_34_0/tools/build/CMake/testing/e/lib.cpp 2007-05-20 19:29:29 EDT (Sun, 20 May 2007)
@@ -1,7 +1,7 @@
 #include <iostream>
 #include <string>
 
-std::string e() { return "e"; }
+std::string link_requires_e() { return "e"; }
 
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk