-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
65 lines (50 loc) · 2.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
project(BeurerScaleManager)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
# Debug
set(DEBUG ON)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
set(DEBUG OFF)
endif("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
include(MacroListAddPrefix)
include(Dependencies)
include_directories(${QT_INCLUDES} ${LIBUSB_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(BSM_SRCS src/main.cpp src/utils.cpp)
set(BSM_HDRS)
set(BSM_UIS)
set(BSM_RCS)
set(BSM_QMS)
add_subdirectory(src)
add_subdirectory(resources)
add_subdirectory(translations)
qt4_wrap_cpp(BSM_SRCS ${BSM_HDRS})
qt4_wrap_ui(BSM_SRCS ${BSM_UIS})
qt4_add_resources(BSM_SRCS ${BSM_RCS})
set_source_files_properties(${BSM_QMS} PROPERTIES OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/translations")
qt4_add_translation(BSM_SRCS ${BSM_QMS})
if(NOT DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
add_definitions("-DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT -DQT_NO_WARNING_OUTPUT")
else(NOT DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
add_definitions("-DDEBUG")
endif(NOT DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set(compiler_common_flags "-Wall -Wsign-compare -Wformat-security -Wpointer-arith")
set(compiler_common_flags "${compiler_common_flags} -fPIC -fdiagnostics-show-option")
set(compiler_common_flags "${compiler_common_flags} -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT")
set(CMAKE_C_FLAGS "${compiler_common_flags} -Wmissing-prototypes ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${compiler_common_flags} -Wnon-virtual-dtor -Woverloaded-virtual ${CMAKE_CXX_FLAGS}")
if(DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
endif(DEBUG)
configure_file(src/config.in.hpp ${CMAKE_CURRENT_BINARY_DIR}/config.hpp ESCAPE_QUOTES @ONLY)
add_executable(BeurerScaleManager ${BSM_SRCS})
target_link_libraries(BeurerScaleManager ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTSQL_LIBRARY} ${LIBUSB_LIBRARIES})
install(TARGETS BeurerScaleManager RUNTIME DESTINATION bin)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/BeurerScaleManager.doxy ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(docs
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)