Fixing cmake conf so that we can use all warnings

This includes using a workaround for a CMake bug.
This commit is contained in:
Strahinja Val Markovic 2012-07-04 21:24:16 -07:00
parent a9eb277da1
commit 570267bbe0
3 changed files with 26 additions and 15 deletions

View File

@ -21,10 +21,11 @@
#
# bcp call: bcp boost/python.hpp boost/bind.hpp boost/lambda/lambda.hpp boost/exception/all.hpp boost/tuple/tuple_io.hpp boost/tuple/tuple_comparison.hpp boost/regex.hpp boost/foreach.hpp boost/smart_ptr.hpp boost/algorithm/string_regex.hpp boost/thread.hpp boost/unordered_map.hpp boost/unordered_set.hpp boost/format.hpp boost/ptr_container/ptr_container.hpp ../BoostParts
# WARNING: When doing this from fresh boost sources, note that
# in the file /boost/config/user.hpp the BOOST_ALL_NO_LIB
# define has been uncommented. Otherwise, we will get linker
# errors on MSVC because of boost auto-linking.
# WARNING: When doing this from fresh boost sources, note that in the file
# /boost/config/user.hpp the BOOST_ALL_NO_LIB define has been uncommented.
# Otherwise, we will get linker errors on MSVC because of boost auto-linking. If
# you don't care about Windows then feel free to use the raw boost version of
# /boost/config/user.hpp
cmake_minimum_required( VERSION 2.8 )
@ -64,6 +65,7 @@ endif()
#############################################################################
include_directories(
SYSTEM
${CMAKE_CURRENT_SOURCE_DIR}
${PYTHON_INCLUDE_DIRS}
)
@ -73,7 +75,9 @@ add_library( BoostParts ${SOURCES} )
#############################################################################
if( CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG )
add_definitions( -Wno-parentheses-equality )
# No warnings. We just use Boost as is so warnings coming from it are just
# noise.
add_definitions( -w )
endif()
#############################################################################

View File

@ -21,6 +21,10 @@ project( indexer )
find_package( PythonLibs REQUIRED )
# This is a workaround for a CMake bug with include_directories(SYSTEM ...)
# on Mac OS X. Bug report: http://public.kitware.com/Bug/view.php?id=10837
set( CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem " )
# The SYSTEM flag makes sure that -isystem[header path] is passed to the
# compiler instead of the standard -I[header path]. Headers included with
# -isystem do not generate warnings (and they shouldn't; e.g. boost warnings are
@ -42,6 +46,8 @@ if( to_remove )
list( REMOVE_ITEM SOURCES ${to_remove} )
endif()
#############################################################################
add_library( ${PROJECT_NAME} SHARED
${SOURCES}
)
@ -51,6 +57,11 @@ target_link_libraries( ${PROJECT_NAME}
${PYTHON_LIBRARIES}
)
#############################################################################
# We don't want the "lib" prefix, it can screw up python when it tries to search
# for our module
set_target_properties( ${PROJECT_NAME} PROPERTIES PREFIX "")
# Even on macs, we want a .so extension instead of a .dylib which is what cmake
@ -69,8 +80,7 @@ endif()
if( CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG )
# We want all warnings, and warnings should be treated as errors
# TODO: this breaks with boost; fix it!
#add_definitions( -Wall -Wextra -Werror )
add_definitions( -Wall -Wextra -Werror )
endif()
add_subdirectory( tests )

View File

@ -23,17 +23,14 @@ if ( COMPILER_IS_CLANG )
add_definitions( -Wno-long-long -Wno-variadic-macros )
endif()
# For whatever reason, cmake does something stupid with pthread detection on
# Mac which makes gtest go stupid too, so we turn of pthread use in gtest; we
# don't really need it either way
if ( APPLE )
add_definitions( -DGTEST_HAS_PTHREAD=0 )
endif()
add_subdirectory( gmock )
include_directories(
${indexer_SOURCE_DIR}
)
include_directories(
SYSTEM
${gtest_SOURCE_DIR}
${gtest_SOURCE_DIR}/include
${gmock_SOURCE_DIR}