Allow shared libraries with BUILD_SHARED_LIBS

This commit is contained in:
Matt Clarkson 2014-07-30 16:59:14 +01:00
parent 4fae2944c7
commit 57fdf38f74
3 changed files with 18 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,4 +1,7 @@
*.a
*.so
*.so.?*
*.dylib
*.cmake
*~
/test/benchmark_test

View File

@ -38,6 +38,10 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86")
add_definitions(-DARCH_X86)
endif()
# The version of the libraries
set(GENERIC_LIB_VERSION "0.0.0")
set(GENERIC_LIB_SOVERSION "0")
# Set up directories
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/src)

View File

@ -1,8 +1,17 @@
set(SOURCE_FILES "benchmark.cc" "colorprint.cc" "commandlineflags.cc" "sleep.cc" "sysinfo.cc" "walltime.cc")
set(RE_FILES "re.cc")
add_library(benchmark_re STATIC ${RE_FILES})
add_library(benchmark STATIC ${SOURCE_FILES} ${RE_FILES})
add_library(benchmark_re ${RE_FILES})
set_target_properties(benchmark_re PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
)
add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
set_target_properties(benchmark PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
)
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
install(