Make unnecessarily hard-coded flags optional (#9)
This commit is contained in:
+21
-10
@@ -2,10 +2,17 @@ cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(livox_sdk)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
message(STATUS "main project dir: " ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# This variable is set by project() in CMake 3.21+
|
||||
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}" PROJECT_IS_TOP_LEVEL)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
option(shared_DEVELOPER_MODE "Enable developer mode" OFF)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
set(THREADS_PTHREAD_ARG
|
||||
"PLEASE_FILL_OUT-FAILED_TO_RUN"
|
||||
@@ -16,12 +23,16 @@ if (UNIX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||
endif(UNIX)
|
||||
|
||||
# Always build the core SDK library
|
||||
add_subdirectory(sdk_core sdk_core)
|
||||
add_subdirectory(sample/hub)
|
||||
add_subdirectory(sample/lidar)
|
||||
add_subdirectory(sample/hub_lvx_file)
|
||||
add_subdirectory(sample/lidar_lvx_file)
|
||||
add_subdirectory(sample_cc/hub)
|
||||
add_subdirectory(sample_cc/lidar)
|
||||
add_subdirectory(sample_cc/trouble_shooting)
|
||||
add_subdirectory(sample_cc/lidar_utc_sync)
|
||||
# Only build the samples if this is the top-level project
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
add_subdirectory(sample/hub)
|
||||
add_subdirectory(sample/lidar)
|
||||
add_subdirectory(sample/hub_lvx_file)
|
||||
add_subdirectory(sample/lidar_lvx_file)
|
||||
add_subdirectory(sample_cc/hub)
|
||||
add_subdirectory(sample_cc/lidar)
|
||||
add_subdirectory(sample_cc/trouble_shooting)
|
||||
add_subdirectory(sample_cc/lidar_utc_sync)
|
||||
endif()
|
||||
@@ -30,10 +30,13 @@ else(WIN32)
|
||||
set(PLATFORM unix)
|
||||
endif (WIN32)
|
||||
|
||||
target_compile_options(${SDK_LIBRARY}
|
||||
# Warnings are only for developers
|
||||
if(shared_DEVELOPER_MODE)
|
||||
target_compile_options(${SDK_LIBRARY}
|
||||
PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wall -Werror -Wno-c++11-long-long>
|
||||
PRIVATE $<$<CXX_COMPILER_ID:AppleClang>:-Wno-unknown-pragmas -Wall -Werror -Wno-c++11-long-long>
|
||||
PRIVATE $<$<CXX_COMPILER_ID:Clang>:-Wno-unknown-pragmas -Wall -Werror -Wno-c++11-long-long>)
|
||||
endif()
|
||||
|
||||
target_sources(${SDK_LIBRARY}
|
||||
PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user