2012-04-15 19:57:10 -04:00
|
|
|
# Copyright (C) 2011 Strahinja Markovic <strahinja.markovic@gmail.com>
|
|
|
|
#
|
|
|
|
# This file is part of YouCompleteMe.
|
|
|
|
#
|
|
|
|
# YouCompleteMe is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# YouCompleteMe is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2012-08-04 21:59:22 -04:00
|
|
|
project( ycm_core_tests )
|
2012-04-15 19:57:10 -04:00
|
|
|
cmake_minimum_required( VERSION 2.8 )
|
|
|
|
|
2013-02-03 00:47:41 -05:00
|
|
|
# The gtest library triggers these warnings, so we turn them off; it's not up to
|
|
|
|
# us to fix gtest warnings, it's up to upstream.
|
2012-04-15 19:57:10 -04:00
|
|
|
if ( COMPILER_IS_CLANG )
|
2012-07-09 16:58:56 -04:00
|
|
|
set( CMAKE_CXX_FLAGS
|
2013-02-03 00:47:41 -05:00
|
|
|
"${CMAKE_CXX_FLAGS} -Wno-long-long -Wno-variadic-macros -Wno-missing-field-initializers -Wno-unused-private-field" )
|
2012-04-15 19:57:10 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_subdirectory( gmock )
|
|
|
|
|
|
|
|
include_directories(
|
2013-10-15 14:19:56 -04:00
|
|
|
${ycm_support_libs_SOURCE_DIR}
|
2012-07-05 00:24:16 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
SYSTEM
|
2013-02-03 00:47:41 -05:00
|
|
|
${gtest_SOURCE_DIR}
|
|
|
|
${gtest_SOURCE_DIR}/include
|
2012-04-15 19:57:10 -04:00
|
|
|
${gmock_SOURCE_DIR}
|
|
|
|
${gmock_SOURCE_DIR}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
link_directories(
|
|
|
|
${Boost_LIBRARY_DIRS}
|
|
|
|
${PYTHON_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2013-02-16 15:23:04 -05:00
|
|
|
file( GLOB_RECURSE SOURCES *.h *.cpp )
|
|
|
|
|
|
|
|
# We don't want gmock sources in this target
|
|
|
|
file( GLOB_RECURSE to_remove gmock/*.h gmock/*.cpp CMakeFiles/*.cpp
|
|
|
|
testdata/*.cpp testdata/*.h )
|
|
|
|
|
|
|
|
if( to_remove )
|
|
|
|
list( REMOVE_ITEM SOURCES ${to_remove} )
|
|
|
|
endif()
|
2012-04-15 19:57:10 -04:00
|
|
|
|
2013-01-13 20:33:35 -05:00
|
|
|
if ( NOT USE_CLANG_COMPLETER )
|
|
|
|
file( GLOB_RECURSE to_remove_clang ClangCompleter/*.h ClangCompleter/*.cpp )
|
|
|
|
|
|
|
|
if( to_remove_clang )
|
|
|
|
list( REMOVE_ITEM SOURCES ${to_remove_clang} )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-04-15 19:57:10 -04:00
|
|
|
add_executable( ${PROJECT_NAME}
|
|
|
|
${SOURCES}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries( ${PROJECT_NAME}
|
2013-10-15 14:19:56 -04:00
|
|
|
${SERVER_LIB}
|
|
|
|
${CLIENT_LIB}
|
2013-10-11 22:27:04 -04:00
|
|
|
gmock )
|
2012-04-15 19:57:10 -04:00
|
|
|
|
2013-05-26 14:59:27 -04:00
|
|
|
|
|
|
|
if ( NOT CMAKE_GENERATOR_IS_XCODE )
|
|
|
|
# The test executable expects a "testdata" dir in its working directory. Why?
|
|
|
|
# Because there's NO reliable, cross-platform way of getting the directory in
|
|
|
|
# which the executable is located.
|
|
|
|
add_custom_target( copy_testdata
|
|
|
|
COMMAND cmake -E copy_directory
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/testdata )
|
|
|
|
else()
|
|
|
|
add_custom_target( copy_testdata
|
|
|
|
COMMAND cmake -E copy_directory
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Debug/testdata
|
|
|
|
COMMAND cmake -E copy_directory
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/testdata
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Release/testdata )
|
|
|
|
|
|
|
|
endif()
|
2012-08-11 22:27:15 -04:00
|
|
|
|
|
|
|
add_dependencies( ${PROJECT_NAME} copy_testdata )
|