2015-01-16 23:20:54 +00:00
|
|
|
cmake_minimum_required (VERSION 2.8.10)
|
2014-06-20 20:00:00 +01:00
|
|
|
|
|
|
|
project (BoringSSL)
|
|
|
|
|
2015-01-24 01:25:44 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -ggdb -fvisibility=hidden")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -ggdb -std=c++0x -fvisibility=hidden")
|
2014-06-20 20:00:00 +01:00
|
|
|
elseif(MSVC)
|
2015-01-29 00:37:10 +00:00
|
|
|
# Disable warnings for implicit integer narrowing.
|
|
|
|
set(CMAKE_C_FLAGS "/wd4267")
|
|
|
|
set(CMAKE_CXX_FLAGS "/wd4267")
|
|
|
|
add_definitions(-D_HAS_EXCEPTIONS=0)
|
2015-01-29 04:34:47 +00:00
|
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
2014-06-20 20:00:00 +01:00
|
|
|
endif()
|
|
|
|
|
2015-01-24 01:25:44 +00:00
|
|
|
if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.5.99") OR
|
|
|
|
CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
2015-01-16 23:20:54 +00:00
|
|
|
endif()
|
|
|
|
|
2014-07-31 00:02:14 +01:00
|
|
|
add_definitions(-DBORINGSSL_IMPLEMENTATION)
|
|
|
|
|
2015-01-28 05:50:21 +00:00
|
|
|
if (BUILD_SHARED_LIBS)
|
2015-01-29 00:37:10 +00:00
|
|
|
add_definitions(-DBORINGSSL_SHARED_LIBRARY)
|
|
|
|
# Enable position-independent code globally. This is needed because
|
|
|
|
# some library targets are OBJECT libraries.
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
2015-01-28 05:50:21 +00:00
|
|
|
endif()
|
|
|
|
|
2014-06-20 20:00:00 +01:00
|
|
|
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "x86_64")
|
2014-07-31 11:09:49 +01:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "x86_64")
|
2014-06-20 20:00:00 +01:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
|
2015-01-29 00:37:10 +00:00
|
|
|
# cmake reports AMD64 on Windows, but we might be building for 32-bit.
|
|
|
|
if (CMAKE_CL_64)
|
|
|
|
set(ARCH "x86_64")
|
|
|
|
else()
|
|
|
|
set(ARCH "x86")
|
|
|
|
endif()
|
2014-06-20 20:00:00 +01:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "x86")
|
2014-07-31 11:09:49 +01:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "x86")
|
2014-08-11 21:27:44 +01:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "x86")
|
2014-06-20 20:00:00 +01:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "arm")
|
2015-01-09 23:44:37 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
|
2015-01-29 00:37:10 +00:00
|
|
|
set(ARCH "aarch64")
|
2014-06-20 20:00:00 +01:00
|
|
|
else()
|
2015-01-29 00:37:10 +00:00
|
|
|
message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
|
2014-06-20 20:00:00 +01:00
|
|
|
endif()
|
|
|
|
|
2014-11-18 20:14:46 +00:00
|
|
|
if (${ARCH} STREQUAL "x86" AND APPLE)
|
2015-01-29 00:37:10 +00:00
|
|
|
# With CMake 2.8.x, ${CMAKE_SYSTEM_PROCESSOR} evalutes to i386 on OS X,
|
|
|
|
# but clang defaults to 64-bit builds on OS X unless otherwise told.
|
|
|
|
# Set ARCH to x86_64 so clang and CMake agree. This is fixed in CMake 3.
|
|
|
|
set(ARCH "x86_64")
|
2014-11-18 20:14:46 +00:00
|
|
|
endif()
|
|
|
|
|
2014-06-20 20:00:00 +01:00
|
|
|
add_subdirectory(crypto)
|
|
|
|
add_subdirectory(ssl)
|
|
|
|
add_subdirectory(ssl/test)
|
|
|
|
add_subdirectory(tool)
|