diff --git a/ecal/core/CMakeLists.txt b/ecal/core/CMakeLists.txt index 3c7d57189..775f8a7c8 100644 --- a/ecal/core/CMakeLists.txt +++ b/ecal/core/CMakeLists.txt @@ -397,7 +397,7 @@ set(ecal_header_base ${ecal_header_msg} ) -ecal_add_ecal_shared_library(${PROJECT_NAME} +ecal_add_library(${PROJECT_NAME} ${ecal_custom_tclap_cpp_src} ${ecal_io_cpp_src} ${ecal_io_mem_cpp_src} @@ -433,7 +433,7 @@ if(UNIX) set_source_files_properties(src/convert_utf.cpp PROPERTIES COMPILE_FLAGS -Wno-implicit-fallthrough) endif() -ecal_add_ecal_shared_library(${PROJECT_NAME}_c ${ecal_c_src} ${ecal_c_win_src}) +ecal_add_library(${PROJECT_NAME}_c ${ecal_c_src} ${ecal_c_win_src}) add_library(eCAL::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) add_library(eCAL::${PROJECT_NAME}_c ALIAS ${PROJECT_NAME}_c) @@ -457,6 +457,11 @@ target_compile_definitions(${PROJECT_NAME} $<$:ECAL_HAS_ROBUST_MUTEX> $<$:ECAL_USE_CLOCKLOCK_MUTEX>) +if(BUILD_SHARED_LIBS) + target_compile_definitions(${PROJECT_NAME}_c PUBLIC eCAL_SHARED_LIB) + target_compile_definitions(${PROJECT_NAME} PUBLIC eCAL_SHARED_LIB) +endif() + if(ECAL_NPCAP_SUPPORT) target_compile_definitions(${PROJECT_NAME} PRIVATE ECAL_NPCAP_SUPPORT) @@ -507,8 +512,8 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${SIMPLEINI_INCLUDE_DIRS}) set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER ecal/core) set_property(TARGET ${PROJECT_NAME}_c PROPERTY FOLDER ecal/core) -ecal_install_ecal_shared_library(${PROJECT_NAME}_c) -ecal_install_ecal_shared_library(${PROJECT_NAME}) +ecal_install_ecal_library(${PROJECT_NAME}_c) +ecal_install_ecal_library(${PROJECT_NAME}) install(DIRECTORY "include/" DESTINATION "${INSTALL_INCLUDE_DIR}" COMPONENT sdk diff --git a/ecal/core/include/ecal/ecal_os.h b/ecal/core/include/ecal/ecal_os.h index a962036f2..5d466cc86 100644 --- a/ecal/core/include/ecal/ecal_os.h +++ b/ecal/core/include/ecal/ecal_os.h @@ -47,7 +47,7 @@ #define ECAL_OS_FREEBSD #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) && defined(eCAL_SHARED_LIB) #ifdef eCAL_EXPORTS #define ECALC_API __declspec(dllexport) #else /* eCAL_EXPORTS */ @@ -64,11 +64,15 @@ #endif #ifdef _MSC_VER + #ifdef eCAL_SHARED_LIB #ifdef eCAL_EXPORTS #define ECALC_API_DEPRECATED __declspec(dllexport deprecated) #else /* eCAL_EXPORTS */ #define ECALC_API_DEPRECATED __declspec(dllimport deprecated) #endif /* eCAL_EXPORTS */ + #else + #define ECALC_API_DEPRECATED + #endif #elif defined(__GNUC__) || defined(__clang__) #define ECALC_API_DEPRECATED __attribute__((deprecated)) #else