diff --git a/CMakeLists.txt b/CMakeLists.txt index 912382b..bafae47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,13 @@ project( LANGUAGES C CXX ASM_MASM 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) set(CMAKE_CXX_STANDARD 11) diff --git a/libcpuid/CMakeLists.txt b/libcpuid/CMakeLists.txt index c857e30..8cebc26 100644 --- a/libcpuid/CMakeLists.txt +++ b/libcpuid/CMakeLists.txt @@ -12,11 +12,8 @@ if("${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "x64") list(APPEND cpuid_sources masm-x64.asm) endif() -if(UNIX) - add_library(cpuid SHARED ${cpuid_sources}) -else() - add_library(cpuid ${cpuid_sources}) -endif() +add_library(cpuid ${cpuid_sources}) +set_property(TARGET cpuid PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) target_include_directories(cpuid SYSTEM PUBLIC $) target_compile_definitions(cpuid PRIVATE VERSION="${PROJECT_VERSION}")