[Feature] Improve uri handling.
[Khopper.git] / CMakeLists.txt
blobc31390894f9f4ce7d72deb6a3fc9ec509fd6fc4d
1 # root
3 cmake_minimum_required(VERSION 2.6)
5 project(Khopper)
6 set(KHOPPER_VERSION_MAJOR "0")
7 set(KHOPPER_VERSION_MINOR "2")
8 set(KHOPPER_VERSION_PATCH "60")
9 set(KHOPPER_VERSION "${KHOPPER_VERSION_MAJOR}.${KHOPPER_VERSION_MINOR}.${KHOPPER_VERSION_PATCH}")
11 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
13 find_package(Qt4 4.6 COMPONENTS Phonon Xml REQUIRED)
15 include(${QT_USE_FILE})
16 include_directories(${Boost_INCLUDE_DIRS})
18 add_definitions(-DKHOPPER_VERSION=${KHOPPER_VERSION})
19 if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
20     add_definitions(-DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT)
21 endif()
22 if(CMAKE_COMPILER_IS_GNUCXX)
23     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wextra -Wall")
24 elseif(MSVC)
25     add_definitions("/D__STDC_CONSTANT_MACROS")
26     if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
27         string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
28     else()
29         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
30     endif()
31     if(CMAKE_CXX_FLAGS_RELEASE MATCHES "/O.")
32         string(REGEX REPLACE "/O." "/Ox" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
33     else()
34         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox")
35     endif()
36     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t- /wd4127;4819 /MP")
37 endif()
38 set(CMAKE_DEBUG_POSTFIX d)
40 add_subdirectory(core)
41 if(QT_PHONON_FOUND)
42     list(APPEND KHOPPER_OPTIONAL_FOUND "Qt Phonon module for GUI module.")
43     add_subdirectory(main)
44 else()
45     list(APPEND KHOPPER_OPTIONAL_NOT_FOUND "Qt Phonon module for GUI module.")
46 endif()
47 add_subdirectory(plugins)
49 list(LENGTH KHOPPER_OPTIONAL_FOUND length)
50 if(NOT ${length} EQUAL 0)
51     message("[Find the fallowing build dependencies:]")
52     foreach(msg ${KHOPPER_OPTIONAL_FOUND})
53         message(${msg})
54     endforeach()
55 endif()
56 list(LENGTH KHOPPER_OPTIONAL_NOT_FOUND length)
57 if(NOT ${length} EQUAL 0)
58     message("[The fallowing build dependencies are not found:]")
59     foreach(msg ${KHOPPER_OPTIONAL_NOT_FOUND})
60         message(${msg})
61     endforeach()
62 endif()