cmake files refactored and fixed to build without warnings
This commit is contained in:
parent
91c95dfe38
commit
95d9b7ca09
3 changed files with 33 additions and 30 deletions
|
@ -6,6 +6,7 @@ if ("${BuildTypeCurr}" LESS "0")
|
|||
endif()
|
||||
unset(BuildTypeCurr)
|
||||
set_property (GLOBAL PROPERTY DEBUG_CONFIGURATIONS "Debug;Release")
|
||||
|
||||
project (WordReference CXX)
|
||||
|
||||
message(STATUS "Configuring ${PROJECT_NAME} for ${CMAKE_BUILD_TYPE}")
|
||||
|
@ -16,42 +17,15 @@ 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)
|
||||
find_package(Boost 1.32.0 REQUIRED program_options)
|
||||
|
||||
set (GNU_COMMON_C_FLAGS "-Werror")
|
||||
set (GNU_COMMON_CXX_FLAGS "-std=c++11 -Werror -fexceptions")
|
||||
set (GNU_COMMON_CXX_FLAGS "-std=gnu++11 -Werror -fexceptions")
|
||||
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()
|
||||
|
||||
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")
|
||||
|
||||
add_definitions(-DJSON_ISO_STRICT)
|
||||
include_directories(SYSTEM
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(
|
||||
src/
|
||||
libjson/
|
||||
)
|
||||
link_directories(
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
add_subdirectory(libjson)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
src/main.cpp
|
||||
src/WordReference.cpp
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
${Boost_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
libjson
|
||||
)
|
||||
add_subdirectory(wordref)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
project (libjson CXX)
|
||||
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DJSON_DEBUG")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -g -ffast-math -fexpensive-optimizations -DJSON_DEBUG")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -g -ffast-math -fexpensive-optimizations")
|
||||
set (CMAKE_CXX_FLAGS_FINAL "${CMAKE_CXX_FLAGS_FINAL} -O3 -ffast-math -fexpensive-optimizations")
|
||||
|
||||
set (major_version "7")
|
||||
|
|
29
wordref/CMakeLists.txt
Normal file
29
wordref/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
project (wordreference CXX)
|
||||
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(Boost 1.32.0 REQUIRED program_options)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DJSON_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
||||
include_directories(SYSTEM
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(
|
||||
../src/
|
||||
../libjson/
|
||||
)
|
||||
link_directories(
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
../src/main.cpp
|
||||
../src/WordReference.cpp
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
${Boost_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
libjson
|
||||
)
|
Loading…
Reference in a new issue