toxcore/CMakeLists.txt

51 lines
1.3 KiB
CMake
Raw Normal View History

2013-06-24 20:55:30 -04:00
cmake_minimum_required(VERSION 2.6.0)
2013-07-12 18:31:57 -04:00
2013-07-30 22:41:51 +04:00
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
2013-07-30 21:00:55 +07:00
if(NOT WIN32)
option(USE_NACL "Use NaCl library instead of libsodium")
endif()
2013-07-31 08:35:06 -04:00
if(USE_NACL)
2013-07-30 21:00:55 +07:00
find_package(NaCl REQUIRED)
include_directories(${NACL_INCLUDE_DIR})
add_definitions(-DVANILLA_NACL)
set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES})
endif()
2013-07-21 20:41:08 -04:00
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
2013-07-17 18:28:53 -04:00
if(NOT WIN32)
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
endif()
2013-07-30 22:41:51 +04:00
find_package(SODIUM REQUIRED)
2013-07-17 18:28:53 -04:00
endif()
2013-07-31 08:35:06 -04:00
if(NOT USE_NACL)
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
endif()
2013-07-17 18:06:05 -04:00
macro(linkCoreLibraries exe_name)
2013-07-21 20:41:08 -04:00
add_dependencies(${exe_name} core)
2013-07-17 18:06:05 -04:00
if(WIN32)
2013-07-21 20:41:08 -04:00
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
2013-07-21 21:17:08 -04:00
target_link_libraries(${exe_name} core
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
2013-07-17 18:06:05 -04:00
ws2_32)
else()
2013-07-30 22:41:51 +04:00
include_directories(${SODIUM_INCLUDE_DIR})
2013-07-21 21:17:08 -04:00
target_link_libraries(${exe_name} core
2013-07-30 21:00:55 +07:00
${LINK_CRYPTO_LIBRARY})
2013-07-17 18:06:05 -04:00
endif()
endmacro()
2013-06-26 01:03:35 -04:00
2013-07-17 18:41:58 -04:00
cmake_policy(SET CMP0011 NEW)
2013-07-21 20:41:08 -04:00
add_subdirectory(core)
add_subdirectory(testing)
2013-07-30 22:41:51 +04:00
add_subdirectory(other)