2016-11-30 13:32:06 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
project(Indivisible)
|
|
|
|
|
2016-11-30 21:20:46 +00:00
|
|
|
cmake_policy(SET CMP0012 OLD)
|
|
|
|
|
2016-11-30 13:32:06 +00:00
|
|
|
set(TARGET_NAME indivisible)
|
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif()
|
|
|
|
|
2016-12-02 15:31:12 +00:00
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
${CMAKE_SOURCE_DIR}/cmake/)
|
|
|
|
|
|
|
|
find_package(GMP REQUIRED)
|
2016-11-30 21:20:46 +00:00
|
|
|
|
2016-12-02 15:34:12 +00:00
|
|
|
include_directories(
|
|
|
|
${GMP_INCLUDE_DIR})
|
|
|
|
|
2016-11-30 13:32:06 +00:00
|
|
|
set(SRCS
|
2016-12-09 22:02:51 +00:00
|
|
|
src/main.c
|
|
|
|
src/list.c)
|
|
|
|
|
|
|
|
# Define the C flags.
|
|
|
|
set(CMAKE_C_FLAGS "-std=gnu99 -Wall -Wextra -Werror -Wfatal-errors -Wmissing-declarations -pedantic-errors")
|
2016-12-14 16:58:12 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g -O0")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3")
|
|
|
|
set(CMAKE_C_FLAGS_MINSIZEREL "-Os")
|
2016-11-30 13:32:06 +00:00
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE MATCHES Debug AND NOT CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
|
|
|
add_definitions(-DNDEBUG)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(${TARGET_NAME} ${SRCS})
|
2016-12-02 15:34:12 +00:00
|
|
|
|
|
|
|
target_link_libraries(${TARGET_NAME}
|
|
|
|
${GMP_LIBRARY})
|