Add STORMLIB_NO_AUTO_LINK define to disable linking with pragma

This commit is contained in:
Lectem
2017-09-17 14:28:01 +02:00
parent 000b3a6635
commit 2d529bcb82
2 changed files with 6 additions and 3 deletions

View File

@@ -308,7 +308,7 @@ endif()
add_library(${LIBRARY_NAME} ${LIB_TYPE} ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS})
target_compile_definitions(${LIBRARY_NAME} PUBLIC) #CMake should take care of the linking
target_compile_definitions(${LIBRARY_NAME} INTERFACE STORMLIB_NO_AUTO_LINK) #CMake will take care of the linking
target_include_directories(${LIBRARY_NAME} PUBLIC src/)
set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "src/StormLib.h;src/StormPort.h")
if(BUILD_SHARED_LIBS)

View File

@@ -99,8 +99,11 @@ extern "C" {
// Z - S for static-linked CRT library, D for multithreaded DLL CRT library
//
#if defined(_MSC_VER) && !defined(__STORMLIB_SELF__)
#if defined(__STORMLIB_SELF__) && !defined(STORMLIB_NO_AUTO_LINK)
#define STORMLIB_NO_AUTO_LINK // Define this if you don't want to link using pragmas when using msvc
#endif
#if defined(_MSC_VER) && !defined(STORMLIB_NO_AUTO_LINK)
#ifdef _DEBUG // DEBUG VERSIONS
#ifndef _UNICODE
#ifdef _DLL