39 lines
1.3 KiB
CMake
39 lines
1.3 KiB
CMake
|
cmake_minimum_required(VERSION 2.8)
|
||
|
|
||
|
project(loguru_example)
|
||
|
|
||
|
if(NOT CMAKE_BUILD_TYPE)
|
||
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||
|
endif(NOT CMAKE_BUILD_TYPE)
|
||
|
|
||
|
MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||
|
|
||
|
if(MSVC)
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall")
|
||
|
else()
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -Wall -Wextra -pedantic")
|
||
|
endif()
|
||
|
|
||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat-pedantic")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-noreturn")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
|
||
|
endif() # Clang
|
||
|
|
||
|
file(GLOB source
|
||
|
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
||
|
# "${CMAKE_CURRENT_SOURCE_DIR}/../*.cpp"
|
||
|
)
|
||
|
|
||
|
add_executable(loguru_example ${source})
|
||
|
|
||
|
find_package(Threads)
|
||
|
target_link_libraries(loguru_example ${CMAKE_THREAD_LIBS_INIT}) # For pthreads
|
||
|
if(NOT WIN32)
|
||
|
target_link_libraries(loguru_example dl) # For ldl
|
||
|
endif()
|