cmake: add support for static build
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
file(GLOB_RECURSE common_sources *.c *.h include/ivy/*.h)
|
||||
|
||||
add_library(ivy-common SHARED ${common_sources})
|
||||
if (IVY_STATIC)
|
||||
add_library(ivy-common STATIC ${common_sources})
|
||||
else ()
|
||||
add_library(ivy-common SHARED ${common_sources})
|
||||
endif ()
|
||||
|
||||
target_include_directories(ivy-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
||||
target_compile_definitions(ivy-common PRIVATE IVY_EXPORT=1)
|
||||
target_compile_definitions(ivy-common PRIVATE IVY_EXPORT=1 IVY_STATIC=${IVY_STATIC})
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef IVY_COMMON_MISC_H_
|
||||
#define IVY_COMMON_MISC_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && IVY_STATIC==0
|
||||
#ifdef IVY_EXPORT
|
||||
#define IVY_API extern __declspec(dllexport)
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user