mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
allow to build either static or shared (#156)
also fix shared if msvc Co-authored-by: Veselin Georgiev <anrieff@gmail.com>
This commit is contained in:
parent
25e6e38c85
commit
ae7b063c8a
2 changed files with 9 additions and 5 deletions
|
@ -7,6 +7,13 @@ project(
|
||||||
LANGUAGES C CXX ASM_MASM
|
LANGUAGES C CXX ASM_MASM
|
||||||
VERSION ${VERSION})
|
VERSION ${VERSION})
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(LIBCPUID_SHARED OFF)
|
||||||
|
else()
|
||||||
|
set(LIBCPUID_SHARED ON)
|
||||||
|
endif()
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared lib" ${LIBCPUID_SHARED})
|
||||||
|
|
||||||
option(LIBCPUID_TESTS "Enable building tests" OFF)
|
option(LIBCPUID_TESTS "Enable building tests" OFF)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
|
@ -12,11 +12,8 @@ if("${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "x64")
|
||||||
list(APPEND cpuid_sources masm-x64.asm)
|
list(APPEND cpuid_sources masm-x64.asm)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
add_library(cpuid SHARED ${cpuid_sources})
|
|
||||||
else()
|
|
||||||
add_library(cpuid ${cpuid_sources})
|
add_library(cpuid ${cpuid_sources})
|
||||||
endif()
|
set_property(TARGET cpuid PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
target_include_directories(cpuid SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
target_include_directories(cpuid SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
|
|
||||||
target_compile_definitions(cpuid PRIVATE VERSION="${PROJECT_VERSION}")
|
target_compile_definitions(cpuid PRIVATE VERSION="${PROJECT_VERSION}")
|
||||||
|
|
Loading…
Reference in a new issue