# # upgrade-engine # # Copyright (c) 2022 Samsung Electronics Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. CMAKE_MINIMUM_REQUIRED(VERSION 2.82) PROJECT(upgrade C CXX) find_package(GTest REQUIRED) enable_testing() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/) IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -fPIE") SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") SET(CMAKE_C_FLAGS_RELEASE "-O2") FIND_PROGRAM(UNAME NAMES uname) IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") MESSAGE("add -DTARGET") ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie") SET(CMAKE_INSTALL_PREFIX "/usr") # set this to ON if you want to build on host OPTION(DEFINE_HOST_BUILD OFF) IF(DEFINE_HOST_BUILD) INCLUDE(CMakeLists.host-build) ELSE() INCLUDE(CMakeLists.target-build) ENDIF()