From a1c69da32657ca94166519e1e522dd1d790bfa47 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Sep 2009 16:50:44 -0400 Subject: QAR-1619: Fix Windows link errors when building INTEGRATION_TEST_lllazy. The problem arose because we were setting LL_COMMON_BUILD in llcommon/CMakeLists.txt, not only for the library build itself but also for its LL_ADD_INTEGRATION_TEST tests. This told all the headers compiled into the INTEGRATION_TEST_lllazy executable that the executable was providing all the llcommon symbols, rather than importing them. The solution is to switch to the llcommon_EXPORTS symbol automagically defined by CMake when building the llcommon shared library itself. --- indra/llcommon/CMakeLists.txt | 2 -- indra/llcommon/llpreprocessor.h | 11 ++++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 147b361ad8..baf374ee38 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -242,7 +242,6 @@ list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) if(LLCOMMON_LINK_SHARED) add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) - add_definitions(-DLL_COMMON_BUILD=1) if(SHARED_LIB_STAGING_DIR) # *FIX:Mani --- @@ -290,7 +289,6 @@ target_link_libraries( add_dependencies(llcommon stage_third_party_libs) - include(LLAddBuildTest) SET(llcommon_TEST_SOURCE_FILES ) diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index f135beed6a..f853e31002 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -149,11 +149,16 @@ #endif // LL_WINDOWS #if LL_COMMON_LINK_SHARED -# if LL_COMMON_BUILD +// CMake automagically defines llcommon_EXPORTS only when building llcommon +// sources, and only when llcommon is a shared library (i.e. when +// LL_COMMON_LINK_SHARED). We must still test LL_COMMON_LINK_SHARED because +// otherwise we can't distinguish between (non-llcommon source) and (llcommon +// not shared). +# if defined(llcommon_EXPORTS) # define LL_COMMON_API LL_DLLEXPORT -# else //LL_COMMON_BUILD +# else //llcommon_EXPORTS # define LL_COMMON_API LL_DLLIMPORT -# endif //LL_COMMON_BUILD +# endif //llcommon_EXPORTS #else // LL_COMMON_LINK_SHARED # define LL_COMMON_API #endif // LL_COMMON_LINK_SHARED -- cgit v1.2.3