2013-08-11 02:02:13 +00:00
|
|
|
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
|
|
|
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Final" CACHE STRING "possible configurations" FORCE)
|
2013-08-11 12:38:51 +00:00
|
|
|
list(FIND CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" BuildTypeCurr)
|
|
|
|
if ("${BuildTypeCurr}" LESS "0")
|
|
|
|
set(CMAKE_BUILD_TYPE "Final" CACHE STRING "Build type defaults to Final" FORCE)
|
|
|
|
endif()
|
|
|
|
unset(BuildTypeCurr)
|
2013-08-11 02:02:13 +00:00
|
|
|
set_property (GLOBAL PROPERTY DEBUG_CONFIGURATIONS "Debug;Release")
|
|
|
|
project (WordReference CXX)
|
|
|
|
|
2013-08-15 17:50:49 +00:00
|
|
|
message(STATUS "Configuring ${PROJECT_NAME} for ${CMAKE_BUILD_TYPE}")
|
2013-08-11 02:02:13 +00:00
|
|
|
|
|
|
|
set (${PROJECT_NAME}_Version_Major 0)
|
|
|
|
set (${PROJECT_NAME}_Version_Minor 1)
|
|
|
|
set (${PROJECT_NAME}_App_Name "\"${PROJECT_NAME}\"")
|
|
|
|
string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
|
|
|
|
set (${PROJECT_NAME}_SourceCodeVar "\"\$${PROJECT_NAME_UPPER}_SOURCE_PATH\"")
|
|
|
|
|
|
|
|
find_package(CURL REQUIRED)
|
2013-08-11 12:38:51 +00:00
|
|
|
find_package(Boost 1.32.0 REQUIRED program_options)
|
2013-08-11 02:02:13 +00:00
|
|
|
|
2013-08-15 17:50:49 +00:00
|
|
|
set (GNU_COMMON_C_FLAGS "-Werror")
|
|
|
|
set (GNU_COMMON_CXX_FLAGS "-std=c++11 -Werror -fexceptions")
|
2013-08-11 12:38:51 +00:00
|
|
|
foreach (ConfigType ${CMAKE_CONFIGURATION_TYPES})
|
|
|
|
string(TOUPPER ${ConfigType} ConfigTypeUpper)
|
|
|
|
set(CMAKE_CXX_FLAGS_${ConfigTypeUpper} "${CMAKE_CXX_FLAGS_${ConfigTypeUpper}} ${GNU_COMMON_CXX_FLAGS} -DDUCK_${ConfigTypeUpper}")
|
|
|
|
set(CMAKE_C_FLAGS_${ConfigTypeUpper} "${CMAKE_C_FLAGS_${ConfigTypeUpper}} ${GNU_COMMON_C_FLAGS} -DDUCK_${ConfigTypeUpper}")
|
|
|
|
endforeach()
|
|
|
|
|
2013-08-15 17:50:49 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DJSON_DEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DJSON_DEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_FINAL "${CMAKE_CXX_FLAGS_FINAL} -DNDEBUG")
|
|
|
|
|
2013-08-11 12:38:51 +00:00
|
|
|
add_definitions(-DJSON_ISO_STRICT)
|
2013-08-11 02:02:13 +00:00
|
|
|
include_directories(SYSTEM
|
|
|
|
${CURL_INCLUDE_DIRS}
|
2013-08-11 12:38:51 +00:00
|
|
|
${Boost_INCLUDE_DIRS}
|
2013-08-11 02:02:13 +00:00
|
|
|
)
|
|
|
|
include_directories(
|
2013-08-11 12:44:03 +00:00
|
|
|
src/
|
2013-08-15 17:50:49 +00:00
|
|
|
libjson/
|
2013-08-11 02:02:13 +00:00
|
|
|
)
|
2013-08-11 12:38:51 +00:00
|
|
|
link_directories(
|
|
|
|
${Boost_LIBRARY_DIRS}
|
|
|
|
)
|
2013-08-11 02:02:13 +00:00
|
|
|
|
2013-08-15 17:50:49 +00:00
|
|
|
add_subdirectory(libjson)
|
2013-08-11 02:02:13 +00:00
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
2013-08-11 12:44:03 +00:00
|
|
|
src/main.cpp
|
|
|
|
src/WordReference.cpp
|
2013-08-11 02:02:13 +00:00
|
|
|
)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
2013-08-11 12:38:51 +00:00
|
|
|
${Boost_LIBRARIES}
|
|
|
|
${CURL_LIBRARIES}
|
2013-08-15 17:50:49 +00:00
|
|
|
libjson
|
2013-08-11 02:02:13 +00:00
|
|
|
)
|