mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-23 05:17:49 +08:00
64 lines
1.9 KiB
Diff
64 lines
1.9 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 26118eb..ccda00b 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -141,7 +141,12 @@ set(XEUS_SOURCES
|
||
|
# Output
|
||
|
# ======
|
||
|
|
||
|
-add_library(xeus SHARED ${XEUS_SOURCES} ${XEUS_HEADERS})
|
||
|
+option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON)
|
||
|
+if (BUILD_SHARED_LIBS)
|
||
|
+ add_library(xeus SHARED ${XEUS_SOURCES} ${XEUS_HEADERS})
|
||
|
+else ()
|
||
|
+ add_library(xeus STATIC ${XEUS_SOURCES} ${XEUS_HEADERS})
|
||
|
+endif ()
|
||
|
|
||
|
if (APPLE)
|
||
|
set_target_properties(xeus PROPERTIES
|
||
|
@@ -166,9 +171,9 @@ target_link_libraries(xeus
|
||
|
|
||
|
OPTION(XEUS_USE_SHARED_CRYPTOPP "Used shared library for cryptopp" OFF)
|
||
|
if (XEUS_USE_SHARED_CRYPTOPP)
|
||
|
- target_link_libraries(xeus PRIVATE cryptopp-shared)
|
||
|
+ target_link_libraries(xeus PUBLIC cryptopp-shared)
|
||
|
else ()
|
||
|
- target_link_libraries(xeus PRIVATE cryptopp-static)
|
||
|
+ target_link_libraries(xeus PUBLIC cryptopp-static)
|
||
|
endif ()
|
||
|
|
||
|
if(NOT MSVC)
|
||
|
@@ -226,6 +231,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
|
||
|
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||
|
endif()
|
||
|
|
||
|
+if (NOT BUILD_SHARED_LIBS)
|
||
|
+ target_compile_definitions(xeus PUBLIC XEUS_STATIC_LIB)
|
||
|
+endif ()
|
||
|
+
|
||
|
if(MSVC)
|
||
|
target_compile_definitions(xeus PUBLIC -DNOMINMAX)
|
||
|
target_compile_options(xeus PUBLIC /DGUID_WINDOWS /MP /bigobj)
|
||
|
diff --git a/include/xeus/xeus.hpp b/include/xeus/xeus.hpp
|
||
|
index 99e1d79..522bb78 100644
|
||
|
--- a/include/xeus/xeus.hpp
|
||
|
+++ b/include/xeus/xeus.hpp
|
||
|
@@ -10,10 +10,14 @@
|
||
|
#define XEUS_EXPORT_HPP
|
||
|
|
||
|
#ifdef _WIN32
|
||
|
- #ifdef XEUS_EXPORTS
|
||
|
- #define XEUS_API __declspec(dllexport)
|
||
|
+ #ifdef XEUS_STATIC_LIB
|
||
|
+ #define XEUS_API
|
||
|
#else
|
||
|
- #define XEUS_API __declspec(dllimport)
|
||
|
+ #ifdef XEUS_EXPORTS
|
||
|
+ #define XEUS_API __declspec(dllexport)
|
||
|
+ #else
|
||
|
+ #define XEUS_API __declspec(dllimport)
|
||
|
+ #endif
|
||
|
#endif
|
||
|
#else
|
||
|
#define XEUS_API
|