You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.6 kB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. cmake_minimum_required(VERSION 3.14)
  2. project(MindInsight)
  3. find_package(Git QUIET)
  4. if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
  5. option(GIT_SUBMODULE "Check submodules during build" ON)
  6. if(GIT_SUBMODULE)
  7. message(STATUS "Updating submodules")
  8. execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
  9. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  10. RESULT_VARIABLE GIT_SUBMOD_RESULT)
  11. if(NOT GIT_SUBMOD_RESULT EQUAL "0")
  12. message(FATAL_ERROR "git submodule update failed with ${GIT_SUBMOD_RESULT}, please checkout submodules.")
  13. endif()
  14. endif()
  15. elseif(NOT EXISTS "${PROJECT_SOURCE_DIR}/third_party/securec/src")
  16. message(FATAL_ERROR "git command not found or not in a git repository, third_party/securec/src not exists.")
  17. else()
  18. message(WARNING "git command not found or not in a git repository, submodules not updated.")
  19. endif()
  20. if(NOT CMAKE_BUILD_TYPE)
  21. set(CMAKE_BUILD_TYPE "Release")
  22. endif()
  23. set(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -fPIC -O0 -Wall -fvisibility=hidden \
  24. -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
  25. -D_LIBCPP_INLINE_VISIBILITY='' -D'_LIBCPP_EXTERN_TEMPLATE(...)='")
  26. set(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -fPIC -O3 -Wall -fvisibility=hidden -Wno-deprecated-declarations")
  27. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  28. #add flags
  29. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
  30. include_directories(./third_party/securec/include)
  31. aux_source_directory(./third_party/securec/src SECUREC_SRCS)
  32. add_library(securec ${SECUREC_SRCS})