Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 1 | # See www/CMake.html for instructions on how to build libcxx with CMake. |
| 2 | |
| 3 | #=============================================================================== |
| 4 | # Setup Project |
| 5 | #=============================================================================== |
| 6 | |
| 7 | project(libcxx CXX C) |
| 8 | cmake_minimum_required(VERSION 2.8) |
| 9 | |
| 10 | set(PACKAGE_NAME libcxx) |
| 11 | set(PACKAGE_VERSION trunk-svn) |
| 12 | set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
| 13 | set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu") |
| 14 | |
| 15 | # Add path for custom modules |
| 16 | set(CMAKE_MODULE_PATH |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 17 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake" |
| 18 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" |
Alexey Samsonov | 179fa78 | 2013-09-30 09:10:01 +0000 | [diff] [blame] | 19 | ${CMAKE_MODULE_PATH} |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 20 | ) |
| 21 | |
| 22 | # Require out of source build. |
| 23 | include(MacroEnsureOutOfSourceBuild) |
| 24 | MACRO_ENSURE_OUT_OF_SOURCE_BUILD( |
| 25 | "${PROJECT_NAME} requires an out of source build. Please create a separate |
| 26 | build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there." |
| 27 | ) |
| 28 | |
Peter Collingbourne | 4c81b00 | 2013-10-03 21:58:25 +0000 | [diff] [blame] | 29 | if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) |
| 30 | set(LIBCXX_BUILT_STANDALONE 1) |
| 31 | endif() |
| 32 | |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 33 | #=============================================================================== |
| 34 | # Setup CMake Options |
| 35 | #=============================================================================== |
| 36 | |
| 37 | # Define options. |
| 38 | option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON) |
| 39 | option(LIBCXX_ENABLE_RTTI "Use run time type information." ON) |
| 40 | option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) |
| 41 | option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) |
| 42 | option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) |
| 43 | option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON) |
| 44 | option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) |
Michael Gottesman | c64c980 | 2013-09-02 07:28:05 +0000 | [diff] [blame] | 45 | option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 46 | |
Peter Collingbourne | d0d308f | 2013-10-06 22:13:19 +0000 | [diff] [blame] | 47 | set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++) |
Michael J. Spencer | db8a030 | 2012-12-31 19:34:21 +0000 | [diff] [blame] | 48 | if (NOT DEFINED LIBCXX_CXX_ABI) |
Dan Albert | 0c6d1a8 | 2014-07-26 23:08:33 +0000 | [diff] [blame^] | 49 | if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi") |
| 50 | set(LIBCXX_CXX_ABI "libcxxabi") |
| 51 | set(LIBCXX_LIBCXXABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include") |
| 52 | set(LIBCXX_CXX_ABI_INTREE 1) |
| 53 | else () |
| 54 | set(LIBCXX_CXX_ABI "none") |
| 55 | endif () |
Michael J. Spencer | db8a030 | 2012-12-31 19:34:21 +0000 | [diff] [blame] | 56 | endif() |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 57 | set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING |
| 58 | "Specify C++ ABI library to use." FORCE) |
Howard Hinnant | 9c07b14 | 2013-08-19 21:42:07 +0000 | [diff] [blame] | 59 | set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS}) |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 60 | |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 61 | #=============================================================================== |
| 62 | # Configure System |
| 63 | #=============================================================================== |
| 64 | |
| 65 | # Get triples. |
| 66 | include(GetTriple) |
| 67 | get_host_triple(LIBCXX_HOST_TRIPLE |
| 68 | LIBCXX_HOST_ARCH |
| 69 | LIBCXX_HOST_VENDOR |
| 70 | LIBCXX_HOST_OS |
| 71 | ) |
| 72 | set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.") |
| 73 | get_target_triple(LIBCXX_TARGET_TRIPLE |
| 74 | LIBCXX_TARGET_ARCH |
| 75 | LIBCXX_TARGET_VENDOR |
| 76 | LIBCXX_TARGET_OS |
| 77 | ) |
| 78 | set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.") |
| 79 | |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 80 | #=============================================================================== |
| 81 | # Add an ABI library if appropriate |
| 82 | #=============================================================================== |
| 83 | |
| 84 | # |
| 85 | # _setup_abi: Set up the build to use an ABI library |
| 86 | # |
| 87 | # Parameters: |
| 88 | # abidefines: A list of defines needed to compile libc++ with the ABI library |
| 89 | # abilibs : A list of libraries to link against |
| 90 | # abifiles : A list of files (which may be relative paths) to copy into the |
| 91 | # libc++ build tree for the build. These files will also be |
| 92 | # installed alongside the libc++ headers. |
| 93 | # abidirs : A list of relative paths to create under an include directory |
| 94 | # in the libc++ build directory. |
| 95 | # |
| 96 | macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs) |
| 97 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines}) |
| 98 | set(${abipathvar} "${${abipathvar}}" |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 99 | CACHE PATH |
| 100 | "Paths to C++ ABI header directories separated by ';'." FORCE |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 101 | ) |
| 102 | set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs}) |
| 103 | set(LIBCXX_ABILIB_FILES ${abifiles}) |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 104 | |
Michael J. Spencer | db8a030 | 2012-12-31 19:34:21 +0000 | [diff] [blame] | 105 | file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include") |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 106 | foreach(_d ${abidirs}) |
| 107 | file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}") |
| 108 | endforeach() |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 109 | |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 110 | foreach(fpath ${LIBCXX_ABILIB_FILES}) |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 111 | set(found FALSE) |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 112 | foreach(incpath ${${abipathvar}}) |
| 113 | if (EXISTS "${incpath}/${fpath}") |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 114 | set(found TRUE) |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 115 | get_filename_component(dstdir ${fpath} PATH) |
| 116 | get_filename_component(ifile ${fpath} NAME) |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 117 | file(COPY "${incpath}/${fpath}" |
| 118 | DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}" |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 119 | ) |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 120 | list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}") |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 121 | endif() |
| 122 | endforeach() |
| 123 | if (NOT found) |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 124 | message(FATAL_ERROR "Failed to find ${fpath}") |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 125 | endif() |
| 126 | endforeach() |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 127 | |
| 128 | add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers}) |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 129 | include_directories("${CMAKE_BINARY_DIR}/include") |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 130 | |
| 131 | install(FILES ${abilib_headers} |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 132 | DESTINATION include/c++/v1 |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 133 | PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 134 | ) |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 135 | endmacro() |
| 136 | |
Peter Collingbourne | d0d308f | 2013-10-06 22:13:19 +0000 | [diff] [blame] | 137 | if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR |
| 138 | "${LIBCXX_CXX_ABI}" STREQUAL "libsupc++") |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 139 | set(_LIBSUPCXX_INCLUDE_FILES |
| 140 | cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h |
| 141 | bits/cxxabi_tweaks.h bits/cxxabi_forced.h |
| 142 | ) |
Peter Collingbourne | d0d308f | 2013-10-06 22:13:19 +0000 | [diff] [blame] | 143 | if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++") |
| 144 | set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX") |
| 145 | set(_LIBSUPCXX_LIBNAME stdc++) |
| 146 | else() |
| 147 | set(_LIBSUPCXX_DEFINES "") |
| 148 | set(_LIBSUPCXX_LIBNAME supc++) |
| 149 | endif() |
| 150 | setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS" |
| 151 | "-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}" |
| 152 | "${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits" |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 153 | ) |
Howard Hinnant | 46c49d1 | 2013-02-07 15:27:39 +0000 | [diff] [blame] | 154 | elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi") |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 155 | setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" "" |
Peter Collingbourne | 66a8fce | 2013-10-03 22:58:36 +0000 | [diff] [blame] | 156 | "c++abi" "cxxabi.h" "" |
Howard Hinnant | 46c49d1 | 2013-02-07 15:27:39 +0000 | [diff] [blame] | 157 | ) |
Dan Albert | 0c6d1a8 | 2014-07-26 23:08:33 +0000 | [diff] [blame^] | 158 | |
| 159 | if (LIBCXX_CXX_ABI_INTREE) |
| 160 | add_dependencies(LIBCXX_CXX_ABI_DEPS cxxabi) |
| 161 | endif () |
Howard Hinnant | 46c49d1 | 2013-02-07 15:27:39 +0000 | [diff] [blame] | 162 | elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt") |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 163 | setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT" |
| 164 | "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" "" |
Howard Hinnant | 46c49d1 | 2013-02-07 15:27:39 +0000 | [diff] [blame] | 165 | ) |
Michael J. Spencer | db8a030 | 2012-12-31 19:34:21 +0000 | [diff] [blame] | 166 | elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none") |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 167 | message(FATAL_ERROR |
Peter Collingbourne | d0d308f | 2013-10-06 22:13:19 +0000 | [diff] [blame] | 168 | "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are " |
Howard Hinnant | b85dea3 | 2013-02-08 19:04:53 +0000 | [diff] [blame] | 169 | "supported for c++ abi." |
| 170 | ) |
Michael J. Spencer | a358fbe | 2012-11-30 21:02:29 +0000 | [diff] [blame] | 171 | endif () |
| 172 | |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 173 | # Configure compiler. |
| 174 | include(config-ix) |
| 175 | |
| 176 | #=============================================================================== |
| 177 | # Setup Compiler Flags |
| 178 | #=============================================================================== |
| 179 | |
| 180 | # Get required flags. |
| 181 | # On all systems the system c++ standard library headers need to be excluded. |
| 182 | if (MSVC) |
| 183 | # MSVC only has -X, which disables all default includes; including the crt. |
| 184 | # Thus, we do nothing and hope we don't accidentally include any of the C++ |
| 185 | # headers. |
| 186 | else() |
| 187 | if (LIBCXX_HAS_NOSTDINCXX_FLAG) |
Saleem Abdulrasool | eb54781 | 2014-03-12 04:11:31 +0000 | [diff] [blame] | 188 | list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++) |
David Fang | 44ead61 | 2014-06-24 20:32:11 +0000 | [diff] [blame] | 189 | string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 190 | endif() |
| 191 | if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG) |
| 192 | list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x) |
| 193 | endif() |
| 194 | endif() |
| 195 | |
| 196 | macro(append_if list condition var) |
| 197 | if (${condition}) |
| 198 | list(APPEND ${list} ${var}) |
| 199 | endif() |
| 200 | endmacro() |
| 201 | |
| 202 | # Get warning flags |
Howard Hinnant | adb73b1 | 2013-10-05 00:07:35 +0000 | [diff] [blame] | 203 | if (NOT MSVC) |
| 204 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall) |
Saleem Abdulrasool | eb54781 | 2014-03-12 04:11:31 +0000 | [diff] [blame] | 205 | list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -Werror=return-type) |
Howard Hinnant | adb73b1 | 2013-10-05 00:07:35 +0000 | [diff] [blame] | 206 | endif() |
Marshall Clow | 0f7afe7 | 2013-10-21 15:56:35 +0000 | [diff] [blame] | 207 | |
Douglas Gregor | f9b6e7e | 2012-06-07 22:26:00 +0000 | [diff] [blame] | 208 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W) |
| 209 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter) |
| 210 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings) |
| 211 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 212 | if (LIBCXX_ENABLE_WERROR) |
Douglas Gregor | f9b6e7e | 2012-06-07 22:26:00 +0000 | [diff] [blame] | 213 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror) |
| 214 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX) |
Alexey Samsonov | f7eb573 | 2013-10-02 07:44:19 +0000 | [diff] [blame] | 215 | else() |
| 216 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error) |
| 217 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 218 | endif() |
| 219 | if (LIBCXX_ENABLE_PEDANTIC) |
Douglas Gregor | f9b6e7e | 2012-06-07 22:26:00 +0000 | [diff] [blame] | 220 | append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 221 | endif() |
| 222 | |
| 223 | # Get feature flags. |
| 224 | # Exceptions |
| 225 | if (LIBCXX_ENABLE_EXCEPTIONS) |
| 226 | # Catches C++ exceptions only and tells the compiler to assume that extern C |
| 227 | # functions never throw a C++ exception. |
| 228 | append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc) |
| 229 | else() |
| 230 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS) |
| 231 | append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-) |
| 232 | append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-) |
| 233 | append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions) |
| 234 | endif() |
| 235 | # RTTI |
| 236 | if (NOT LIBCXX_ENABLE_RTTI) |
| 237 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI) |
| 238 | append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-) |
| 239 | append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti) |
| 240 | endif() |
| 241 | # Assert |
Howard Hinnant | e103a3d | 2012-08-05 17:37:39 +0000 | [diff] [blame] | 242 | string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) |
| 243 | if (LIBCXX_ENABLE_ASSERTIONS) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 244 | # MSVC doesn't like _DEBUG on release builds. See PR 4379. |
| 245 | if (NOT MSVC) |
| 246 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG) |
| 247 | endif() |
| 248 | # On Release builds cmake automatically defines NDEBUG, so we |
| 249 | # explicitly undefine it: |
| 250 | if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE") |
| 251 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG) |
| 252 | endif() |
| 253 | else() |
| 254 | if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE") |
| 255 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG) |
| 256 | endif() |
| 257 | endif() |
Howard Hinnant | 4a0e74f | 2013-02-25 15:50:36 +0000 | [diff] [blame] | 258 | # Static library |
| 259 | if (NOT LIBCXX_ENABLE_SHARED) |
| 260 | list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC) |
| 261 | endif() |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 262 | |
| 263 | # This is the _ONLY_ place where add_definitions is called. |
Marshall Clow | 0f7afe7 | 2013-10-21 15:56:35 +0000 | [diff] [blame] | 264 | if (MSVC) |
| 265 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) |
| 266 | endif() |
| 267 | |
Saleem Abdulrasool | 89a52ff | 2014-03-12 04:11:28 +0000 | [diff] [blame] | 268 | string(REPLACE ";" " " LIBCXX_CXX_REQUIRED_FLAGS "${LIBCXX_CXX_REQUIRED_FLAGS}") |
| 269 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_REQUIRED_FLAGS}") |
| 270 | |
| 271 | string(REPLACE ";" " " LIBCXX_CXX_WARNING_FLAGS "${LIBCXX_CXX_WARNING_FLAGS}") |
| 272 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_WARNING_FLAGS}") |
| 273 | |
| 274 | string(REPLACE ";" " " LIBCXX_CXX_FEATURE_FLAGS "${LIBCXX_CXX_FEATURE_FLAGS}") |
| 275 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FEATURE_FLAGS}") |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 276 | |
| 277 | #=============================================================================== |
| 278 | # Setup Source Code |
| 279 | #=============================================================================== |
| 280 | |
| 281 | include_directories(include) |
Howard Hinnant | c4962b3 | 2013-11-15 17:18:57 +0000 | [diff] [blame] | 282 | add_subdirectory(include) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 283 | |
| 284 | # Add source code. This also contains all of the logic for deciding linker flags |
| 285 | # soname, etc... |
| 286 | add_subdirectory(lib) |
| 287 | |
| 288 | #=============================================================================== |
| 289 | # Setup Tests |
| 290 | #=============================================================================== |
| 291 | |
| 292 | add_subdirectory(test) |