forked from OSchip/llvm-project
CMake: add version information into the clang executable and libclang
shared library. llvm-svn: 126502
This commit is contained in:
parent
f4aec20e97
commit
be8705bd3f
|
|
@ -234,6 +234,16 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
|
|||
|
||||
add_definitions( -D_GNU_SOURCE -DHAVE_CLANG_CONFIG_H )
|
||||
|
||||
# Clang version information
|
||||
set(CLANG_EXECUTABLE_VERSION
|
||||
"${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}" CACHE STRING
|
||||
"Version number that will be placed into the clang executable, in the form XX.YY")
|
||||
set(LIBCLANG_LIBRARY_VERSION
|
||||
"${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}" CACHE STRING
|
||||
"Version number that will be placed into the libclang library , in the form XX.YY")
|
||||
mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
|
||||
|
||||
|
||||
option(CLANG_BUILD_EXAMPLES "Build CLANG example programs." OFF)
|
||||
if(CLANG_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ add_clang_executable(clang
|
|||
cc1as_main.cpp
|
||||
)
|
||||
|
||||
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
|
||||
|
||||
if(UNIX)
|
||||
set(CLANGXX_LINK_OR_COPY create_symlink)
|
||||
else()
|
||||
|
|
@ -47,6 +49,7 @@ add_custom_target(clang++ ALL
|
|||
"${clang_pp}"
|
||||
DEPENDS clang)
|
||||
set_target_properties(clang++ PROPERTIES FOLDER "Clang executables")
|
||||
|
||||
set_property(DIRECTORY APPEND
|
||||
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
|
||||
|
||||
|
|
|
|||
|
|
@ -30,15 +30,10 @@ add_clang_library(libclang
|
|||
)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# dylib versioning information
|
||||
# FIXME: Is there a more CMake-ish way to handle this?
|
||||
set(LIBCLANG_VERSION 1
|
||||
CACHE STRING "Version number of the libclang library")
|
||||
set(LIBCLANG_SUBVERSION 0
|
||||
CACHE STRING "Minor version number of the libclang library")
|
||||
set(LIBCLANG_LINK_FLAGS
|
||||
"-Wl,-current_version -Wl,${LIBCLANG_VERSION}.${LIBCLANG_SUBVERSION} -Wl,-compatibility_version -Wl,1")
|
||||
# Darwin-specific linker flags
|
||||
|
||||
set(LIBCLANG_LINK_FLAGS "-Wl,-compatibility_version -Wl,1")
|
||||
|
||||
set(LIBCLANG_LINK_FLAGS
|
||||
"${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
|
||||
|
||||
|
|
@ -48,6 +43,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|||
INSTALL_NAME_DIR "@executable_path/../lib")
|
||||
endif()
|
||||
|
||||
# Versioning information
|
||||
set_target_properties(libclang PROPERTIES VERSION ${LIBCLANG_LIBRARY_VERSION})
|
||||
|
||||
if(MSVC)
|
||||
# windows.h doesn't compile with /Za
|
||||
get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
|
||||
|
|
|
|||
Loading…
Reference in New Issue