Ticket #31169: CMakeLists.txt

File CMakeLists.txt, 2.9 KB (added by adfernandes (Andrew Fernandes), 13 years ago)
Line 
1cmake_minimum_required( VERSION 2.8.5 )
2
3project( boost )
4
5file( GLOB_RECURSE headers boost/*.hpp )
6install( DIRECTORY boost DESTINATION "${BOOST_DESTROOT}/include" )
7
8macro( find_and_use_package name )
9    find_package( ${name} REQUIRED )
10    include_directories( ${${name}_INCLUDE_DIRS} )
11    link_directories   ( ${${name}_LIBRARY_DIRS} )   
12endmacro( find_and_use_package )
13
14find_and_use_package( ZLIB )
15find_and_use_package( BZIP2 )
16find_and_use_package( EXPAT )
17
18# Since we are building under MacPorts, we can ASSUME that the 'icu' package has been installed as a prerequisite
19execute_process( COMMAND ${MACPORTS_PREFIX}/bin/icu-config --cppflags OUTPUT_VARIABLE ICU_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE )
20execute_process( COMMAND ${MACPORTS_PREFIX}/bin/icu-config --ldflags  OUTPUT_VARIABLE ICU_LIBRARY_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE )
21include_directories( ICU_INCLUDE_DIRS} )
22link_directories   ( ICU_LIBRARY_DIRS} )   
23
24include_directories( . )
25
26macro( add_boost_library name directory )
27
28    set( name "${name}" )
29    set( directory "${directory}" )
30
31    # *** rm ../boost/pch.hpp
32    # *** include_directories( ${directory} ) # *** HMM... math has a header in one of the sub-dirs... maybe save current include directories, add, then pop?
33    # *** see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:COMPILE_FLAGS
34    file( GLOB_RECURSE boost_${name}_sources ${directory}/*.cpp )
35
36    add_library( boost_${name}        SHARED ${boost_${name}_sources} )
37    set_target_properties( boost_${name}        PROPERTIES PREFIX "libboost_" )
38    set_target_properties( boost_${name}        PROPERTIES LINKER_LANGUAGE CXX )
39
40    add_library( boost_${name}-static STATIC ${boost_${name}_sources} )
41    set_target_properties( boost_${name}-static PROPERTIES OUTPUT_NAME "${name}" )
42    set_target_properties( boost_${name}-static PROPERTIES PREFIX "libboost_" )
43    set_target_properties( boost_${name}-static PROPERTIES LINKER_LANGUAGE CXX )
44
45    install( TARGETS boost_${name} boost_${name}-static LIBRARY DESTINATION "${BOOST_DESTROOT}/lib" NAMELINK_SKIP ARCHIVE DESTINATION "${BOOST_DESTROOT}/lib" )
46
47endmacro( add_boost_library )
48
49
50add_boost_library( math libs/math/src )
51
52# *** TODO - add support for precompiled headers, or just fake it?
53# *** TODO - python and openmpi
54# *** TODO - install the headers and libraries
55
56#@ find . -type d -name "src" | grep -v '/doc/'
57
58# libs/chrono/src
59# libs/date_time/src
60# libs/exception/src
61# libs/filesystem/v2/src
62# libs/filesystem/v3/src
63# libs/graph/src
64# libs/graph_parallel/src
65# libs/iostreams/src
66# libs/locale/src
67# libs/math/src
68# libs/mpi/src
69# libs/mpl/preprocessed/src
70# libs/program_options/src
71# libs/random/src
72# libs/regex/src
73# libs/serialization/src
74# libs/signals/src
75# libs/smart_ptr/src
76# libs/system/src
77# libs/test/src
78# libs/test/tools/console_test_runner/src
79# libs/thread/src
80# libs/timer/src
81# libs/wave/src
82#
83# libs/python/src
84# libs/mpi/src/python
85#
86# libs/python/pyste/src