Created
November 13, 2019 16:08
-
-
Save aditya369007/00e6ae0749b709473438c0e093375351 to your computer and use it in GitHub Desktop.
Skeleton CmakeLists for Boost Libs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CMakeList.txt : CMake project for CMakeProject10, include source and define | |
# project specific logic here. | |
# | |
cmake_minimum_required (VERSION 3.8) | |
# Add source to this project's executable. | |
add_executable (CMakeProject10 "main.cpp") | |
# TODO: Add tests and install targets if needed. | |
set(CMAKE_CXX_STANDARD 14) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
set(CMAKE_CXX_EXTENSIONS OFF) | |
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") | |
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
endif() | |
find_package(Boost REQUIRED COMPONENTS thread) | |
include_directories(${Boost_INCLUDE_DIRS}) | |
target_link_libraries(CMakeProject10 ${Boost_LIBRARIES}) | |
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU") | |
target_compile_options(CMakeProject10 PRIVATE -Wall -Wextra -Wunreachable-code -Wpedantic) | |
endif() | |
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |
target_compile_options(CMakeProject10 PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn ) | |
endif() | |
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") | |
target_compile_options(CMakeProject10 PRIVATE /W4 /w44265 /w44061 /w44062 ) | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment