Get rid of usage of CMake module
[src/low-level-can-generator.git] / conf.d / config.cmake
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 IoT.bzh
3 #
4 # author: Fulup Ar Foll <fulup@iot.bzh>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ###########################################################################
18
19 # Project Info
20 # ------------------
21 set(PROJECT_NAME can-config-generator)
22 set(PROJECT_VERSION "1.5")
23 set(PROJECT_PRETTY_NAME "CAN configuration generator")
24 set(PROJECT_DESCRIPTION "Generator that convert JSON file following OpenXC spec to configuration-generated.cpp file for the low level CAN binding.")
25 set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/src/low-level-can-generator")
26 set(PROJECT_ICON "icon.png")
27 set(PROJECT_AUTHOR "Loïc Collignon")
28 set(PROJECT_AUTHOR_MAIL "loic.collignon@iot.bzh")
29 set(PROJECT_ICON "icon.png")
30 set(PROJECT_LICENCE "APL2.0")
31 set(PROJECT_LANGUAGES,"CXX")
32
33 project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
34
35 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
36 set(CMP0048 1)
37
38 if(NOT CMAKE_BUILD_TYPE)
39         set(CMAKE_BUILD_TYPE "RELEASE")
40 endif()
41
42 # Static constante definition
43 # -----------------------------
44 add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
45                     -Wall
46                     -Wextra
47                     -Wconversion
48                     -Wno-unused-parameter
49                     -Wno-sign-compare
50                     -Wno-sign-conversion
51                     -Werror=implicit-function-declaration
52                     -ffunction-sections
53                     -fdata-sections
54                     -fPIC
55                     -Werror=maybe-uninitialized
56                    )
57
58 if(${CMAKE_BUILD_TYPE} STREQUAL "RELEASE")
59         add_compile_options(-O2 -D_FORTIFY_SOURCE=2)
60 elseif(${CMAKE_BUILD_TYPE} STREQUAL "DEBUG")
61         add_compile_options(-g -ggdb -O0)
62 endif()
63
64 # (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
65 # ---------------------------------------------------------------------
66 # set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
67 set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
68 set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)