cmake
project config
cmake_minimum_required(VERSION 3.15)
project(smart_isp VERSION 1.0)
compile config
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
set(CMAKE_CXX_STANDARD 14)
project sources files config
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/cJSON
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/common
${PROJECT_SOURCE_DIR}/src/flow_config)
aux_source_directory(${PROJECT_SOURCE_DIR}/3rdparty/cJSON ALL_SRCS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src ALL_SRCS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/common ALL_SRCS)
3rdparty lib config
set(OpenCV_DIR $ENV{OPENCV_HOME})
find_package(OpenCV REQUIRED)
if(${OpenCV})
message(STATUS "OpenCV library status:")
message(STATUS "version: ${OpenCV_VERSION}")
message(STATUS "libraries: ${OpenCV_LIBS}")
message(STATUS "include path: ${OpenCV_INCLUDE_DIRS}")
endif()
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARY_DIRS})
sub module lib compile config
config subdir CMakeLists.txt first
add_subdirectory(src/xxx)
internal libray config
link_directories(${PROJECT_SOURCE_DIR}/lib)
set(EXTRA_LIBS ${MY_LIBS} xxxlib yyylib)
executable file config
add_executable(smart_isp ${ALL_SRCS})
target_link_libraries(smart_isp ${OpenCV_LIBS})
output dir config
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)