mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
add9c0b6dc
It is now compiled under 'toxcore' instead of just 'core' to be able to be installed without conflicts.
56 lines
1.3 KiB
CMake
Executable File
56 lines
1.3 KiB
CMake
Executable File
cmake_minimum_required(VERSION 2.6.0)
|
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
|
|
|
if(UNIX)
|
|
find_package(Curses REQUIRED)
|
|
endif()
|
|
|
|
if(NOT WIN32)
|
|
option(USE_NACL "Use NaCl library instead of libsodium")
|
|
endif()
|
|
|
|
if(USE_NACL)
|
|
find_package(NaCl REQUIRED)
|
|
|
|
include_directories(${NACL_INCLUDE_DIR})
|
|
add_definitions(-DVANILLA_NACL)
|
|
|
|
set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES})
|
|
endif()
|
|
|
|
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
|
|
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()
|
|
find_package(SODIUM REQUIRED)
|
|
endif()
|
|
|
|
if(NOT USE_NACL)
|
|
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
|
|
endif()
|
|
|
|
macro(linkCoreLibraries exe_name)
|
|
add_dependencies(${exe_name} toxcore)
|
|
if(WIN32)
|
|
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
|
|
target_link_libraries(${exe_name} toxcore
|
|
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
|
|
ws2_32)
|
|
else()
|
|
include_directories(${SODIUM_INCLUDE_DIR})
|
|
target_link_libraries(${exe_name} toxcore
|
|
${LINK_CRYPTO_LIBRARY})
|
|
|
|
endif()
|
|
endmacro()
|
|
|
|
cmake_policy(SET CMP0011 NEW)
|
|
|
|
add_subdirectory(core)
|
|
add_subdirectory(testing)
|
|
add_subdirectory(other)
|
|
add_subdirectory(docs)
|