rename dirs
[android/external-libkmsxx.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2 project(kms++)
4 include(CheckCXXCompilerFlag)
6 IF(NOT CMAKE_BUILD_TYPE)
7     message(STATUS "Setting build type to 'Release' as none was specified.")
8     SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
9     set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
10 ENDIF()
12 string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
14 set(LIBKMS_ENABLE_PYTHON ON CACHE BOOL "Enable Python wrappers")
15 set(LIBKMS_ENABLE_KMSCUBE OFF CACHE BOOL "Enable kmscube")
17 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
18 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wno-unused-parameter")
20 if (CMAKE_COMPILER_IS_GNUCC)
21     if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
22         # GCC 4.x seems to warn too much
23         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers")
24     endif()
25 endif()
27 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
29 # static link libc
30 # set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
32 if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
33     CHECK_CXX_COMPILER_FLAG("-flto" HAS_LTO_FLAG)
35     if (HAS_LTO_FLAG)
36         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
37         set(CMAKE_AR gcc-ar)
38         set(CMAKE_RANLIB gcc-ranlib)
39     endif()
40 endif()
42 find_package(PkgConfig REQUIRED)
43 pkg_check_modules(LIBDRM libdrm>=2.4.64 REQUIRED)
45 enable_testing()
47 add_subdirectory(kms++)
48 add_subdirectory(kms++util)
49 add_subdirectory(utils)
51 if(LIBKMS_ENABLE_KMSCUBE)
52         add_subdirectory(kmscube)
53 endif()
55 if(LIBKMS_ENABLE_PYTHON)
56         add_subdirectory(py)
57 endif()