Merge pull request #385 from feed57005/master

Fixed compilation under MSVC(11)
This commit is contained in:
Val Markovic 2013-06-13 17:59:13 -07:00
commit f5bf0a28ef
4 changed files with 23 additions and 12 deletions

View File

@ -115,8 +115,6 @@ endif()
# Special compiler and linker flags for MSVC
if( MSVC )
add_definitions( /DUNICODE /D_UNICODE /Zc:wchar_t- )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" )
set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
endif()

View File

@ -82,6 +82,12 @@ elseif( COMPILER_IS_CLANG )
set( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
endif()
# For MSVC enable UNICODE and compilation on multiple processors
if( MSVC )
add_definitions( /DUNICODE /D_UNICODE /Zc:wchar_t- )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
endif()
# When used with Clang, adding the -std=c++0x flag to CMAKE_CXX_FLAGS will cause
# the compiler to output a warning during linking:
# clang: warning: argument unused during compilation: '-std=c++0x'

View File

@ -29,9 +29,9 @@ if ( NOT PYTHONLIBS_VERSION_STRING VERSION_LESS "3.0.0" )
endif()
option( USE_CLANG_COMPLETER "Use Clang semantic completer for C/C++/ObjC" OFF )
option( PATH_TO_LLVM_ROOT "Path to the root of a LLVM+Clang binary distribution" )
option( USE_SYSTEM_LIBCLANG "Set to ON to use the system libclang library" OFF )
option( EXTERNAL_LIBCLANG_PATH "Path libclang library to use" )
set( PATH_TO_LLVM_ROOT "" CACHE PATH "Path to the root of a LLVM+Clang binary distribution" )
set( EXTERNAL_LIBCLANG_PATH "" CACHE PATH "Path libclang library to use" )
if ( USE_CLANG_COMPLETER AND NOT USE_SYSTEM_LIBCLANG AND NOT PATH_TO_LLVM_ROOT )
message( "Downloading Clang 3.2" )
@ -104,7 +104,7 @@ endif()
if ( NOT EXTERNAL_LIBCLANG_PATH AND PATH_TO_LLVM_ROOT )
# Need TEMP because find_library does not work with an option variable
find_library( TEMP clang
find_library( TEMP NAMES clang libclang
PATHS ${PATH_TO_LLVM_ROOT}/lib
NO_DEFAULT_PATH )
set( EXTERNAL_LIBCLANG_PATH ${TEMP} )
@ -232,11 +232,18 @@ target_link_libraries( ${PROJECT_NAME}
)
if( LIBCLANG_TARGET )
if( NOT WIN32 )
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND cp "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
else()
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${PATH_TO_LLVM_ROOT}/bin/libclang.dll" "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endif()
endif()
#############################################################################

View File

@ -166,7 +166,7 @@ FiletypeIdentifierMap ExtractIdentifiersFromTagsFile(
continue;
std::string identifier( matches[ 1 ] );
fs::path path( matches[ 2 ] );
fs::path path( matches[ 2 ].str() );
if ( path.is_relative() )
path = path_to_tag_file.parent_path() / path;