Files
bobbycar-boardcomputer-firm…/CMakeLists.txt

40 lines
1.5 KiB
CMake
Raw Normal View History

2021-06-28 21:43:20 +02:00
cmake_minimum_required(VERSION 3.16.3)
2021-09-18 21:32:50 +02:00
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sdkconfig)
message(FATAL_ERROR "sdkconfig not found (please run ./switchconf.sh)")
endif()
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.cmake)
message(FATAL_ERROR "config.cmake not found (please run ./switchconf.sh)")
endif()
file(READ_SYMLINK ${CMAKE_CURRENT_SOURCE_DIR}/sdkconfig result)
if (result STREQUAL "")
message(FATAL_ERROR "sdkconfig is not a symlink (please run ./switchconf.sh)")
endif()
file(READ_SYMLINK ${CMAKE_CURRENT_SOURCE_DIR}/config.cmake result)
if (result STREQUAL "")
message(FATAL_ERROR "config.cmake is not a symlink (please run ./switchconf.sh)")
endif()
include(config.cmake)
2021-06-28 21:43:20 +02:00
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(${BOBBY_APP_NAME})
2021-09-18 21:32:50 +02:00
set(expected_build_folder "${CMAKE_CURRENT_SOURCE_DIR}/build")
file(READ_SYMLINK "${expected_build_folder}" expected_build_folder_resolved)
if(NOT IS_ABSOLUTE "${expected_build_folder_resolved}")
2021-09-18 21:54:58 +02:00
get_filename_component(dir "${expected_build_folder}" DIRECTORY)
2021-09-18 21:32:50 +02:00
set(expected_build_folder_resolved "${dir}/${expected_build_folder_resolved}")
endif()
if (NOT PROJECT_BINARY_DIR STREQUAL "${expected_build_folder}" AND NOT PROJECT_BINARY_DIR STREQUAL "${expected_build_folder_resolved}")
message(FATAL_ERROR "building in ${PROJECT_BINARY_DIR} is not supported, you have to build in ${expected_build_folder} or ${expected_build_folder_resolved} (please run ./switchconf.sh)")
endif()