Skip to content

Commit

Permalink
Merge pull request dropbox#96 from jnguyen75/fix-windows-compile
Browse files Browse the repository at this point in the history
Fix MSVC Compilation: Add MSVC warning flags
  • Loading branch information
artwyman authored Apr 11, 2017
2 parents f450ff3 + 067fd49 commit db00e93
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ endif()
add_library(json11 json11.cpp)
target_include_directories(json11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(json11
PRIVATE -fPIC -fno-rtti -fno-exceptions -Wall -Wextra -Werror)
PRIVATE -fPIC -fno-rtti -fno-exceptions -Wall)

# Set warning flags, which may vary per platform
include(CheckCXXCompilerFlag)
set(_possible_warnings_flags /W4 /WX -Wextra -Werror)
foreach(_warning_flag in ${_possible_warnings_flags})
CHECK_CXX_COMPILER_FLAG(_warning_flag _flag_supported)
if(${_flag_supported})
target_compile_options(json11 PRIVATE ${_warning_flag})
endif()
endforeach()

configure_file("json11.pc.in" "json11.pc" @ONLY)

if (JSON11_BUILD_TESTS)
Expand Down

0 comments on commit db00e93

Please sign in to comment.