blob: f4af4e0697247db87d39c3ec07bbbc580cb96ed8 [file] [log] [blame]
Michael J. Spencer626916f2010-12-10 19:47:54 +00001# Get sources
Howard Hinnant92a07002011-09-22 19:10:18 +00002file(GLOB sources ../src/*.cpp)
3if(WIN32)
4 file(GLOB win32_sources ../src/support/win32/*.cpp)
5 list(APPEND sources ${win32_sources})
6endif()
Michael J. Spencer626916f2010-12-10 19:47:54 +00007
8# Add all the headers to the project for IDEs.
9if (MSVC_IDE OR XCODE)
10 file(GLOB_RECURSE headers ../include/*)
Howard Hinnant92a07002011-09-22 19:10:18 +000011 if(WIN32)
12 file( GLOB win32_headers ../include/support/win32/*.h)
13 list(APPEND headers ${win32_headers})
14 endif()
Michael J. Spencer626916f2010-12-10 19:47:54 +000015 # Force them all into the headers dir on MSVC, otherwise they end up at
16 # project scope because they don't have extensions.
17 if (MSVC_IDE)
18 source_group("Header Files" FILES ${headers})
19 endif()
20endif()
21
22if (LIBCXX_ENABLE_SHARED)
23 add_library(cxx SHARED
24 ${sources}
25 ${headers}
26 )
27else()
28 add_library(cxx STATIC
29 ${sources}
30 ${headers}
31 )
32endif()
33
34# Generate library list.
35append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
36append_if(libraries LIBCXX_HAS_C_LIB c)
37append_if(libraries LIBCXX_HAS_M_LIB m)
Howard Hinnant20542c02011-05-24 12:54:00 +000038append_if(libraries LIBCXX_HAS_RT_LIB rt)
Michael J. Spencer626916f2010-12-10 19:47:54 +000039append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
40
41target_link_libraries(cxx ${libraries})
42
43# Setup flags.
44append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
45append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
46
47set_target_properties(cxx
48 PROPERTIES
49 COMPILE_FLAGS "${compile_flags}"
50 LINK_FLAGS "${link_flags}"
51 OUTPUT_NAME "c++"
52 VERSION "1.0"
53 SOVERSION "1"
54 )
55
56install(TARGETS cxx
57 LIBRARY DESTINATION lib
58 ARCHIVE DESTINATION lib
59 )
60
61install(DIRECTORY ../include/
62 DESTINATION include/c++/v1
63 FILES_MATCHING
Howard Hinnant8dcad972011-03-03 01:59:23 +000064 PATTERN "*"
Howard Hinnant542b0f02011-03-02 17:29:46 +000065 PATTERN ".svn" EXCLUDE
Michael J. Spencer626916f2010-12-10 19:47:54 +000066 )