From 195997d58960409df3fb750ab281551e545064bd Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 9 Feb 2023 15:26:56 -0800 Subject: [PATCH 1/4] Convert all usages of target_link_libraries to use PUBLIC/PRIVATE specifiers CMake requires all usages to be consistent, and we're going to add these specifiers as part of the sanitizer work, so make them consistently used across the repo here. --- src/coreclr/debug/createdump/CMakeLists.txt | 2 ++ src/coreclr/dlls/mscordbi/CMakeLists.txt | 4 +-- src/coreclr/gc/CMakeLists.txt | 2 +- src/coreclr/gc/sample/CMakeLists.txt | 2 +- src/coreclr/hosts/corerun/CMakeLists.txt | 7 ++-- src/coreclr/hosts/coreshim/CMakeLists.txt | 1 + src/coreclr/ilasm/CMakeLists.txt | 2 ++ src/coreclr/ildasm/exe/CMakeLists.txt | 2 ++ src/coreclr/jit/CMakeLists.txt | 1 + src/coreclr/pal/src/CMakeLists.txt | 11 ++++-- .../lttngprovider/CMakeLists.txt | 1 + src/coreclr/pal/tests/palsuite/CMakeLists.txt | 1 + .../palsuite/eventprovider/CMakeLists.txt | 2 +- .../pal_sxs/test1/CMakeLists.txt | 3 ++ .../tools/StressLogAnalyzer/CMakeLists.txt | 3 +- src/coreclr/tools/superpmi/mcs/CMakeLists.txt | 2 ++ .../superpmi-shim-collector/CMakeLists.txt | 2 ++ .../superpmi-shim-counter/CMakeLists.txt | 2 ++ .../superpmi-shim-simple/CMakeLists.txt | 2 ++ .../tools/superpmi/superpmi/CMakeLists.txt | 2 ++ src/coreclr/utilcode/CMakeLists.txt | 4 +-- src/mono/dlls/dbgshim/CMakeLists.txt | 2 +- src/mono/dlls/mscordbi/CMakeLists.txt | 2 +- src/mono/mono/component/CMakeLists.txt | 4 +-- src/mono/mono/eventpipe/test/CMakeLists.txt | 2 +- src/mono/mono/metadata/CMakeLists.txt | 2 +- src/mono/mono/mini/CMakeLists.txt | 4 +-- src/mono/mono/profiler/CMakeLists.txt | 12 +++---- src/mono/wasi/runtime/CMakeLists.txt | 3 +- src/mono/wasm/runtime/CMakeLists.txt | 3 +- .../apphost/standalone/CMakeLists.txt | 2 +- .../corehost/apphost/static/CMakeLists.txt | 1 + src/native/corehost/comhost/CMakeLists.txt | 4 +-- src/native/corehost/common.cmake | 8 ++--- .../corehost/fxr/standalone/CMakeLists.txt | 4 +-- .../hostpolicy/standalone/CMakeLists.txt | 2 +- src/native/corehost/ijwhost/CMakeLists.txt | 2 +- .../corehost/test/comsxs/CMakeLists.txt | 2 +- .../corehost/test/fx_ver/CMakeLists.txt | 2 +- src/native/corehost/test/ijw/CMakeLists.txt | 4 +-- .../corehost/test/nativehost/CMakeLists.txt | 8 ++--- .../CMakeLists.txt | 4 +-- .../CMakeLists.txt | 12 +------ src/native/libs/System.Native/CMakeLists.txt | 1 + .../System.Net.Security.Native/CMakeLists.txt | 1 + .../CMakeLists.txt | 1 + .../CMakeLists.txt | 1 + .../CMakeLists.txt | 1 + .../ArrayMarshalling/BoolArray/CMakeLists.txt | 4 +-- .../ArrayMarshalling/SafeArray/CMakeLists.txt | 4 +-- .../Interop/BestFitMapping/CMakeLists.txt | 4 +-- .../CMakeLists.txt | 2 +- .../ComWrappers/WeakReference/CMakeLists.txt | 2 +- .../Interop/COM/Dynamic/Server/CMakeLists.txt | 2 +- .../DefaultInterfaces/CMakeLists.txt | 2 +- .../COM/NativeClients/Dispatch/CMakeLists.txt | 2 +- .../COM/NativeClients/Events/CMakeLists.txt | 2 +- .../NativeClients/Licensing/CMakeLists.txt | 2 +- .../NativeClients/Primitives/CMakeLists.txt | 2 +- .../Interop/COM/NativeServer/CMakeLists.txt | 2 +- .../DisabledRuntimeMarshalling/CMakeLists.txt | 2 +- .../DllImportPath/CMakeLists.txt | 34 +++++++++---------- .../ExactSpelling/CMakeLists.txt | 6 ++-- .../Interop/ExecInDefAppDom/CMakeLists.txt | 4 +-- .../FuncPtrAsDelegateParam/CMakeLists.txt | 4 +-- .../ConflictingNames/CMakeLists.txt | 2 +- .../Primitives/CMakeLists.txt | 2 +- .../CopyConstructorMarshaler/CMakeLists.txt | 2 +- .../IjwNativeCallingManagedDll/CMakeLists.txt | 2 +- .../Interop/IJW/IjwNativeDll/CMakeLists.txt | 2 +- .../Interop/IJW/NativeVarargs/CMakeLists.txt | 2 +- .../Interop/IJW/ijwhostmock/CMakeLists.txt | 2 +- src/tests/Interop/LayoutClass/CMakeLists.txt | 2 +- .../MarshalAPI/FunctionPointer/CMakeLists.txt | 4 +-- .../MarshalAPI/IUnknown/CMakeLists.txt | 4 +-- .../mono-embedding-api-test/CMakeLists.txt | 2 +- .../NativeLibraryToLoad/CMakeLists.txt | 6 ++-- .../ObjectiveC/AutoReleaseTest/CMakeLists.txt | 4 +-- .../ObjectiveCMarshalAPI/CMakeLists.txt | 2 +- .../LPArrayNative/CMakeLists.txt | 24 ++++++------- .../LPArrayNative/CMakeLists.txt | 18 +++++----- .../PInvoke/ArrayWithOffset/CMakeLists.txt | 2 +- .../Interop/PInvoke/AsAny/CMakeLists.txt | 2 +- .../PInvoke/Attributes/LCID/CMakeLists.txt | 18 +++++----- .../BestFitMapping/Char/CMakeLists.txt | 20 +++++------ .../BestFitMapping/LPStr/CMakeLists.txt | 20 +++++------ .../PInvoke/CriticalHandles/CMakeLists.txt | 22 ++++++------ .../PInvoke/CustomMarshalers/CMakeLists.txt | 2 +- .../Interop/PInvoke/DateTime/CMakeLists.txt | 18 +++++----- .../Interop/PInvoke/Decimal/CMakeLists.txt | 14 ++++---- .../Interop/PInvoke/Delegate/CMakeLists.txt | 2 +- .../PInvoke/IEnumerator/CMakeLists.txt | 2 +- .../PInvoke/SafeHandles/CMakeLists.txt | 16 ++++----- .../PInvoke/SetLastError/CMakeLists.txt | 4 +-- .../PInvoke/PassingByOut/CMakeLists.txt | 20 +++++------ .../PInvoke/PassingByRef/CMakeLists.txt | 22 ++++++------ .../PassingByOut/CMakeLists.txt | 24 ++++++------- .../PassingByRef/CMakeLists.txt | 22 ++++++------ .../Interop/PInvoke/Varargs/CMakeLists.txt | 4 +-- .../Interop/PInvoke/Variant/CMakeLists.txt | 2 +- .../PInvoke/Vector2_3_4/CMakeLists.txt | 14 ++++---- .../PrimitiveMarshalling/Bool/CMakeLists.txt | 6 ++-- .../EnumMarshalling/CMakeLists.txt | 2 +- .../UIntPtr/CMakeLists.txt | 6 ++-- src/tests/Interop/RefCharArray/CMakeLists.txt | 2 +- src/tests/Interop/SimpleStruct/CMakeLists.txt | 6 ++-- .../StringMarshalling/AnsiBSTR/CMakeLists.txt | 2 +- .../StringMarshalling/BSTR/CMakeLists.txt | 2 +- .../StringMarshalling/LPSTR/CMakeLists.txt | 2 +- .../StringMarshalling/LPTSTR/CMakeLists.txt | 2 +- .../StringMarshalling/UTF8/CMakeLists.txt | 2 +- .../VBByRefStr/CMakeLists.txt | 4 +-- .../StructMarshalling/PInvoke/CMakeLists.txt | 6 ++-- .../MarshalExpStruct/CMakeLists.txt | 18 +++++----- .../MarshalSeqStruct/CMakeLists.txt | 18 +++++----- .../SuppressGCTransition/CMakeLists.txt | 18 +++++----- .../UnmanagedCallersOnly/CMakeLists.txt | 4 +-- .../SmokeTests/PInvoke/CMakeLists.txt | 2 +- .../SmokeTests/SharedLibrary/CMakeLists.txt | 2 +- 119 files changed, 347 insertions(+), 319 deletions(-) diff --git a/src/coreclr/debug/createdump/CMakeLists.txt b/src/coreclr/debug/createdump/CMakeLists.txt index 96920bb2da6b91..2489b8d135e1c4 100644 --- a/src/coreclr/debug/createdump/CMakeLists.txt +++ b/src/coreclr/debug/createdump/CMakeLists.txt @@ -24,6 +24,7 @@ if(CLR_CMAKE_HOST_WIN32) ) target_link_libraries(createdump + PRIVATE kernel32.lib ${STATIC_MT_CRT_LIB} advapi32.lib @@ -83,6 +84,7 @@ else() endif(CLR_CMAKE_HOST_OSX) target_link_libraries(createdump + PRIVATE corguids dbgutil # share the PAL in the dac module diff --git a/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/coreclr/dlls/mscordbi/CMakeLists.txt index 95e92034e238f6..c3c41a494eb416 100644 --- a/src/coreclr/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/dlls/mscordbi/CMakeLists.txt @@ -90,7 +90,7 @@ if(CLR_CMAKE_HOST_WIN32) ${STATIC_MT_VCRT_LIB} ) - target_link_libraries(mscordbi ${COREDBI_LIBRARIES}) + target_link_libraries(mscordbi PRIVATE ${COREDBI_LIBRARIES}) elseif(CLR_CMAKE_HOST_UNIX) @@ -100,7 +100,7 @@ elseif(CLR_CMAKE_HOST_UNIX) mscordaccore ) - target_link_libraries(mscordbi ${COREDBI_LIBRARIES}) + target_link_libraries(mscordbi PRIVATE ${COREDBI_LIBRARIES}) add_dependencies(mscordbi mscordaccore) diff --git a/src/coreclr/gc/CMakeLists.txt b/src/coreclr/gc/CMakeLists.txt index e2ef118ca0637f..fe3abb32eb4b84 100644 --- a/src/coreclr/gc/CMakeLists.txt +++ b/src/coreclr/gc/CMakeLists.txt @@ -106,7 +106,7 @@ convert_to_absolute_path(GC_SOURCES ${GC_SOURCES}) add_library_clr(clrgc SHARED ${GC_SOURCES}) add_dependencies(clrgc eventing_headers) -target_link_libraries(clrgc ${GC_LINK_LIBRARIES}) +target_link_libraries(clrgc PRIVATE ${GC_LINK_LIBRARIES}) install_clr(TARGETS clrgc DESTINATIONS . COMPONENT runtime) add_definitions(-DBUILD_AS_STANDALONE) diff --git a/src/coreclr/gc/sample/CMakeLists.txt b/src/coreclr/gc/sample/CMakeLists.txt index cf8c1694961e8a..94a736e8c8126d 100644 --- a/src/coreclr/gc/sample/CMakeLists.txt +++ b/src/coreclr/gc/sample/CMakeLists.txt @@ -63,5 +63,5 @@ add_executable_clr(gcsample ) if(CLR_CMAKE_TARGET_WIN32) - target_link_libraries(gcsample ${GC_LINK_LIBRARIES}) + target_link_libraries(gcsample PRIVATE ${GC_LINK_LIBRARIES}) endif() diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index c5ce0861651c72..86ae704780d96c 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -19,6 +19,7 @@ add_executable_clr(corerun if(CLR_CMAKE_HOST_WIN32) target_link_libraries(corerun + PRIVATE advapi32.lib oleaut32.lib uuid.lib @@ -27,13 +28,13 @@ if(CLR_CMAKE_HOST_WIN32) ${STATIC_MT_VCRT_LIB} ) else(CLR_CMAKE_HOST_WIN32) - target_link_libraries(corerun ${CMAKE_DL_LIBS}) + target_link_libraries(corerun PRIVATE ${CMAKE_DL_LIBS}) # Required to expose symbols for global symbol discovery - target_link_libraries(corerun -rdynamic) + target_link_libraries(corerun PRIVATE -rdynamic) # Android implements pthread natively if(NOT CLR_CMAKE_TARGET_ANDROID) - target_link_libraries(corerun pthread) + target_link_libraries(corerun PRIVATE pthread) endif() endif(CLR_CMAKE_HOST_WIN32) diff --git a/src/coreclr/hosts/coreshim/CMakeLists.txt b/src/coreclr/hosts/coreshim/CMakeLists.txt index e25caf7dfa5d44..03d5755c8ee7eb 100644 --- a/src/coreclr/hosts/coreshim/CMakeLists.txt +++ b/src/coreclr/hosts/coreshim/CMakeLists.txt @@ -13,6 +13,7 @@ add_library_clr(CoreShim ) target_link_libraries(CoreShim + PRIVATE utilcodestaticnohost advapi32.lib oleaut32.lib diff --git a/src/coreclr/ilasm/CMakeLists.txt b/src/coreclr/ilasm/CMakeLists.txt index cdbe2c84953c31..40d465b0c11d93 100644 --- a/src/coreclr/ilasm/CMakeLists.txt +++ b/src/coreclr/ilasm/CMakeLists.txt @@ -109,6 +109,7 @@ endif(CLR_CMAKE_TARGET_WIN32) if(CLR_CMAKE_HOST_UNIX) target_link_libraries(ilasm + PRIVATE ${ILASM_LINK_LIBRARIES} utilcodestaticnohost mscorrc @@ -118,6 +119,7 @@ if(CLR_CMAKE_HOST_UNIX) ) else() target_link_libraries(ilasm + PRIVATE ${ILASM_LINK_LIBRARIES} ole32 oleaut32 diff --git a/src/coreclr/ildasm/exe/CMakeLists.txt b/src/coreclr/ildasm/exe/CMakeLists.txt index 66bd5aaff9ad23..7cc5ea90b667de 100644 --- a/src/coreclr/ildasm/exe/CMakeLists.txt +++ b/src/coreclr/ildasm/exe/CMakeLists.txt @@ -99,6 +99,7 @@ endif(CLR_CMAKE_HOST_WIN32) if(CLR_CMAKE_HOST_UNIX) target_link_libraries(ildasm + PRIVATE ${ILDASM_LINK_LIBRARIES} mscorrc coreclrpal @@ -107,6 +108,7 @@ if(CLR_CMAKE_HOST_UNIX) ) else() target_link_libraries(ildasm + PRIVATE ${ILDASM_LINK_LIBRARIES} ole32 oleaut32 diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index b39a7316530d52..f479f51ab2352b 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -564,6 +564,7 @@ function(add_jit jitName) set_property(TARGET ${jitName} APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORTS_FILE}) target_link_libraries(${jitName} + PRIVATE ${JIT_LINK_LIBRARIES} ${JIT_ARCH_LINK_LIBRARIES} ) diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt index 74fc5d3bc5cd52..bd5a6bdf4d5b22 100644 --- a/src/coreclr/pal/src/CMakeLists.txt +++ b/src/coreclr/pal/src/CMakeLists.txt @@ -273,6 +273,7 @@ if(CLR_CMAKE_TARGET_OSX) find_library(SECURITY Security) find_library(SYSTEM System) target_link_libraries(coreclrpal + PUBLIC ${COREFOUNDATION} ${CORESERVICES} ${SECURITY} @@ -282,6 +283,7 @@ endif(CLR_CMAKE_TARGET_OSX) if(CLR_CMAKE_TARGET_FREEBSD) target_link_libraries(coreclrpal + PUBLIC pthread rt ${UNWIND_LIBS} @@ -292,27 +294,30 @@ if(CLR_CMAKE_TARGET_LINUX) # On Android, we don't need to link with gcc_s, pthread and rt if(NOT CLR_CMAKE_TARGET_ANDROID) target_link_libraries(coreclrpal + PUBLIC gcc_s pthread rt ) else(NOT CLR_CMAKE_TARGET_ANDROID) target_link_libraries(coreclrpal + PUBLIC ${ANDROID_GLOB} ${LZMA}) endif(NOT CLR_CMAKE_TARGET_ANDROID) target_link_libraries(coreclrpal + PUBLIC dl ) if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND) - target_link_libraries(coreclrpal ${UNWIND_LIBS}) + target_link_libraries(coreclrpal PUBLIC ${UNWIND_LIBS}) endif(CLR_CMAKE_USE_SYSTEM_LIBUNWIND) # bundled libunwind requires using libucontext on alpine and x86 and ppc64le if(CLR_CMAKE_TARGET_ALPINE_LINUX AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_POWERPC64)) - target_link_libraries(coreclrpal ucontext) + target_link_libraries(coreclrpal PUBLIC ucontext) endif(CLR_CMAKE_TARGET_ALPINE_LINUX AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_POWERPC64)) endif(CLR_CMAKE_TARGET_LINUX) @@ -324,6 +329,7 @@ if(CLR_CMAKE_TARGET_NETBSD) add_definitions(-D_KMEMUSER) find_library(KVM kvm) target_link_libraries(coreclrpal + PUBLIC pthread rt ${UNWIND} @@ -333,6 +339,7 @@ endif(CLR_CMAKE_TARGET_NETBSD) if(CLR_CMAKE_TARGET_SUNOS) target_link_libraries(coreclrpal + PUBLIC pthread rt ) diff --git a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt index 8773cd797bcfb6..d2562ef8e32dc7 100644 --- a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -63,6 +63,7 @@ add_dependencies(coreclrtraceptprovider generated_eventing_headers) find_library(LTTNG NAMES lttng-ust) target_link_libraries(coreclrtraceptprovider + PUBLIC ${LTTNG} ) diff --git a/src/coreclr/pal/tests/palsuite/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/CMakeLists.txt index 68323303790614..91d9e35fab703e 100644 --- a/src/coreclr/pal/tests/palsuite/CMakeLists.txt +++ b/src/coreclr/pal/tests/palsuite/CMakeLists.txt @@ -641,6 +641,7 @@ add_executable_clr(paltests add_dependencies(paltests coreclrpal) target_link_libraries(paltests + PUBLIC ${COMMON_TEST_LIBRARIES} ) diff --git a/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt index fdf326edb83781..1546971e22f2e4 100644 --- a/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt +++ b/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt @@ -37,7 +37,7 @@ if(FEATURE_EVENT_TRACE) endif(CLR_CMAKE_HOST_LINUX) endif(FEATURE_EVENT_TRACE) -target_link_libraries(eventprovidertest ${EVENT_PROVIDER_DEPENDENCIES} coreclrpal) +target_link_libraries(eventprovidertest PUBLIC ${EVENT_PROVIDER_DEPENDENCIES} coreclrpal) add_dependencies(eventprovidertest eventing_headers) install (TARGETS eventprovidertest DESTINATION paltests/eventprovider COMPONENT paltests EXCLUDE_FROM_ALL) diff --git a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt index f9b5f0175caa31..a272bdb58bb43b 100644 --- a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt +++ b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt @@ -40,6 +40,7 @@ add_dependencies(paltest_pal_sxs_test1_dll1 ) target_link_libraries(paltest_pal_sxs_test1_dll1 + PUBLIC ${COMMON_TEST_LIBRARIES} m coreclrpal @@ -71,6 +72,7 @@ add_dependencies(paltest_pal_sxs_test1_dll2 ) target_link_libraries(paltest_pal_sxs_test1_dll2 + PUBLIC ${COMMON_TEST_LIBRARIES} ) @@ -86,6 +88,7 @@ add_dependencies(paltest_pal_sxs_test1 ) target_link_libraries(paltest_pal_sxs_test1 + PUBLIC paltest_pal_sxs_test1_dll1 paltest_pal_sxs_test1_dll2 ) diff --git a/src/coreclr/tools/StressLogAnalyzer/CMakeLists.txt b/src/coreclr/tools/StressLogAnalyzer/CMakeLists.txt index 7654f027435513..3ef795455d7077 100644 --- a/src/coreclr/tools/StressLogAnalyzer/CMakeLists.txt +++ b/src/coreclr/tools/StressLogAnalyzer/CMakeLists.txt @@ -1,13 +1,14 @@ -set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) add_executable_clr(StressLogAnalyzer StressLogAnalyzer.cpp StressLogDump.cpp StressLogPlugin.cpp) if(CLR_CMAKE_TARGET_WIN32) target_link_libraries(StressLogAnalyzer + PRIVATE ${STATIC_MT_CRT_LIB} ${STATIC_MT_VCRT_LIB} ) else() target_link_libraries(StressLogAnalyzer + PRIVATE coreclrpal ) endif(CLR_CMAKE_TARGET_WIN32) diff --git a/src/coreclr/tools/superpmi/mcs/CMakeLists.txt b/src/coreclr/tools/superpmi/mcs/CMakeLists.txt index 8ce4c197250822..07951028de8872 100644 --- a/src/coreclr/tools/superpmi/mcs/CMakeLists.txt +++ b/src/coreclr/tools/superpmi/mcs/CMakeLists.txt @@ -54,6 +54,7 @@ target_precompile_headers(mcs PRIVATE "$<$:standardpch.h>" if(CLR_CMAKE_HOST_UNIX) target_link_libraries(mcs + PRIVATE utilcodestaticnohost mscorrc coreclrpal @@ -61,6 +62,7 @@ if(CLR_CMAKE_HOST_UNIX) ) else() target_link_libraries(mcs + PRIVATE advapi32.lib ${STATIC_MT_CRT_LIB} ${STATIC_MT_CPP_LIB} diff --git a/src/coreclr/tools/superpmi/superpmi-shim-collector/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-collector/CMakeLists.txt index ad97bbcaff2535..bc6d618b599469 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-collector/CMakeLists.txt +++ b/src/coreclr/tools/superpmi/superpmi-shim-collector/CMakeLists.txt @@ -69,6 +69,7 @@ set_property(TARGET superpmi-shim-collector APPEND_STRING PROPERTY LINK_DEPENDS if(CLR_CMAKE_HOST_UNIX) target_link_libraries(superpmi-shim-collector + PRIVATE utilcodestaticnohost mscorrc coreclrpal @@ -76,6 +77,7 @@ if(CLR_CMAKE_HOST_UNIX) ) else() target_link_libraries(superpmi-shim-collector + PRIVATE advapi32.lib ${STATIC_MT_CRT_LIB} ${STATIC_MT_CPP_LIB} diff --git a/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt index 576ea739566b0a..1bf782d963e06e 100644 --- a/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt +++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt @@ -50,6 +50,7 @@ target_precompile_headers(superpmi-shim-counter PRIVATE "$<$:standardpc if(CLR_CMAKE_HOST_UNIX) target_link_libraries(superpmi + PRIVATE utilcodestaticnohost mscorrc coreclrpal @@ -58,6 +59,7 @@ if(CLR_CMAKE_HOST_UNIX) ) else() target_link_libraries(superpmi + PRIVATE version.lib advapi32.lib ${STATIC_MT_CRT_LIB} diff --git a/src/coreclr/utilcode/CMakeLists.txt b/src/coreclr/utilcode/CMakeLists.txt index 76d5b0e61dc0fe..37ab9dfae002f2 100644 --- a/src/coreclr/utilcode/CMakeLists.txt +++ b/src/coreclr/utilcode/CMakeLists.txt @@ -92,8 +92,8 @@ target_sources(utilcode INTERFACE $) add_library_clr(utilcodestaticnohost STATIC ${UTILCODE_STATICNOHOST_SOURCES}) if(CLR_CMAKE_HOST_UNIX) - target_link_libraries(utilcodestaticnohost nativeresourcestring) - target_link_libraries(utilcode_dac nativeresourcestring) + target_link_libraries(utilcodestaticnohost PUBLIC nativeresourcestring) + target_link_libraries(utilcode_dac PUBLIC nativeresourcestring) target_link_libraries(utilcode INTERFACE nativeresourcestring) add_dependencies(utilcode_dac coreclrpal) add_dependencies(utilcode_obj coreclrpal) diff --git a/src/mono/dlls/dbgshim/CMakeLists.txt b/src/mono/dlls/dbgshim/CMakeLists.txt index f403a0acc778da..adb41b47612d8d 100644 --- a/src/mono/dlls/dbgshim/CMakeLists.txt +++ b/src/mono/dlls/dbgshim/CMakeLists.txt @@ -81,5 +81,5 @@ if(CLR_CMAKE_HOST_UNIX) ) endif() -target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES} monoapi) +target_link_libraries(dbgshim PRIVATE ${DBGSHIM_LIBRARIES} monoapi) install(TARGETS dbgshim DESTINATION lib) diff --git a/src/mono/dlls/mscordbi/CMakeLists.txt b/src/mono/dlls/mscordbi/CMakeLists.txt index a056ea03ca5db6..c570777dca93a1 100644 --- a/src/mono/dlls/mscordbi/CMakeLists.txt +++ b/src/mono/dlls/mscordbi/CMakeLists.txt @@ -152,5 +152,5 @@ if(CLR_CMAKE_HOST_UNIX) ) endif() -target_link_libraries(mscordbi ${COREDBI_LIBRARIES} monoapi) +target_link_libraries(mscordbi PRIVATE ${COREDBI_LIBRARIES} monoapi) install(TARGETS mscordbi DESTINATION lib) diff --git a/src/mono/mono/component/CMakeLists.txt b/src/mono/mono/component/CMakeLists.txt index ef815af4782478..acb2a2b6b8b769 100644 --- a/src/mono/mono/component/CMakeLists.txt +++ b/src/mono/mono/component/CMakeLists.txt @@ -149,13 +149,13 @@ endif() foreach(component IN LISTS components) if(NOT DISABLE_COMPONENT_OBJECTS) add_library("${component}-objects" OBJECT "${${component}-sources}") - target_link_libraries("${component}-objects" component_base) + target_link_libraries("${component}-objects" PUBLIC component_base) foreach(dependency IN LISTS "${component}-dependencies") add_dependencies("${component}-objects" "${dependency}") endforeach() endif() add_library("${component}-stub-objects" OBJECT "${${component}-stub-sources}") - target_link_libraries("${component}-stub-objects" component_base) + target_link_libraries("${component}-stub-objects" PUBLIC component_base) endforeach() if(NOT DISABLE_COMPONENTS AND NOT STATIC_COMPONENTS) diff --git a/src/mono/mono/eventpipe/test/CMakeLists.txt b/src/mono/mono/eventpipe/test/CMakeLists.txt index 72e4bafe9e4cb1..7f14908f8369a3 100644 --- a/src/mono/mono/eventpipe/test/CMakeLists.txt +++ b/src/mono/mono/eventpipe/test/CMakeLists.txt @@ -33,7 +33,7 @@ if(ENABLE_PERFTRACING) set(CMAKE_SKIP_RPATH 1) add_executable(ep-test ${EVENTPIPE_TEST_SOURCES} ${EVENTPIPE_TEST_HEADERS}) target_sources(ep-test PRIVATE "${mono-components-objects}") - target_link_libraries(ep-test monosgen-static ${OS_LIBS} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS} monoapi) + target_link_libraries(ep-test PUBLIC monosgen-static ${OS_LIBS} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS} monoapi) if(ICU_LDFLAGS) set_target_properties(ep-test PROPERTIES LINK_FLAGS ${ICU_LDFLAGS}) endif() diff --git a/src/mono/mono/metadata/CMakeLists.txt b/src/mono/mono/metadata/CMakeLists.txt index 797637a566cbc7..eb4b6e5119d7ed 100644 --- a/src/mono/mono/metadata/CMakeLists.txt +++ b/src/mono/mono/metadata/CMakeLists.txt @@ -3,7 +3,7 @@ # if(DISABLE_ICALL_TABLES) add_library(mono-icall-table STATIC "../metadata/icall-table.c") -target_link_libraries(mono-icall-table monoapi) +target_link_libraries(mono-icall-table PUBLIC monoapi) install(TARGETS mono-icall-table LIBRARY) else() set(icall_table_sources "icall-table.c") diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index ef4e7551618603..62a31e58920312 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -297,7 +297,7 @@ endif() if(ENABLE_INTERP_LIB) add_library(mono-ee-interp STATIC "${interp_sources}") -target_link_libraries(mono-ee-interp monoapi) +target_link_libraries(mono-ee-interp PRIVATE monoapi) install(TARGETS mono-ee-interp LIBRARY) if(HOST_WASM AND CMAKE_BUILD_TYPE STREQUAL "Debug") # Always optimize the interpreter, even in Debug builds. Unoptimized interp_exec_method and @@ -413,7 +413,7 @@ if(NOT DISABLE_SHARED_LIBS) install(TARGETS monosgen-shared LIBRARY) if(HOST_WIN32 AND TARGET_AMD64) add_library(monosgen-shared-dac SHARED "mini-windows-dlldac.c") - target_link_libraries(monosgen-shared-dac monoapi) + target_link_libraries(monosgen-shared-dac PRIVATE monoapi) set_target_properties(monosgen-shared-dac PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME}-dac) endif() diff --git a/src/mono/mono/profiler/CMakeLists.txt b/src/mono/mono/profiler/CMakeLists.txt index b2a3d3c8e68501..45e57b15174602 100644 --- a/src/mono/mono/profiler/CMakeLists.txt +++ b/src/mono/mono/profiler/CMakeLists.txt @@ -14,32 +14,32 @@ if(NOT DISABLE_LIBS) # Build the logging profiler only for certain platforms add_library(mono-profiler-log SHARED helper.c log.c log-args.c ${ZLIB_SOURCES}) target_compile_definitions(mono-profiler-log PRIVATE -DMONO_DLL_EXPORT) - target_link_libraries(mono-profiler-log monosgen-shared eglib_objects monoapi) + target_link_libraries(mono-profiler-log PRIVATE monosgen-shared eglib_objects monoapi) if(HOST_ANDROID) - target_link_libraries(mono-profiler-log log) + target_link_libraries(mono-profiler-log PRIVATE log) endif() install(TARGETS mono-profiler-log LIBRARY) add_library(mono-profiler-log-static STATIC helper.c log.c log-args.c) - target_link_libraries(mono-profiler-log-static monoapi) + target_link_libraries(mono-profiler-log-static PRIVATE monoapi) set_target_properties(mono-profiler-log-static PROPERTIES OUTPUT_NAME mono-profiler-log) install(TARGETS mono-profiler-log-static LIBRARY) if(NOT DISABLE_LOG_PROFILER_GZ) - target_link_libraries(mono-profiler-log ${Z_LIBS}) + target_link_libraries(mono-profiler-log PRIVATE ${Z_LIBS}) endif() endif() if(NOT HOST_WASI) add_library(mono-profiler-aot-static STATIC aot.c helper.c) - target_link_libraries(mono-profiler-aot-static monoapi) + target_link_libraries(mono-profiler-aot-static PRIVATE monoapi) set_target_properties(mono-profiler-aot-static PROPERTIES OUTPUT_NAME mono-profiler-aot) install(TARGETS mono-profiler-aot-static LIBRARY) endif() if(HOST_BROWSER) add_library(mono-profiler-browser-static STATIC browser.c) - target_link_libraries(mono-profiler-browser-static monoapi) + target_link_libraries(mono-profiler-browser-static PRIVATE monoapi) set_target_properties(mono-profiler-browser-static PROPERTIES OUTPUT_NAME mono-profiler-browser) install(TARGETS mono-profiler-browser-static LIBRARY) endif() diff --git a/src/mono/wasi/runtime/CMakeLists.txt b/src/mono/wasi/runtime/CMakeLists.txt index 8e4114f0c31e45..7ac5b8489f84cd 100644 --- a/src/mono/wasi/runtime/CMakeLists.txt +++ b/src/mono/wasi/runtime/CMakeLists.txt @@ -14,6 +14,7 @@ target_compile_options(dotnet PUBLIC @${NATIVE_BIN_DIR}/src/wasi-default.rsp @${ set_target_properties(dotnet PROPERTIES COMPILE_FLAGS ${CONFIGURATION_WASICC_FLAGS}) target_link_libraries(dotnet + PRIVATE #TODOWASI ${ICU_LIB_DIR}/libicuuc.a #TODOWASI ${ICU_LIB_DIR}/libicui18n.a ${MONO_ARTIFACTS_DIR}/libmono-component-hot_reload-static.a @@ -32,7 +33,7 @@ set_target_properties(dotnet PROPERTIES LINK_FLAGS "@${NATIVE_BIN_DIR}/src/wasi-default.rsp @${NATIVE_BIN_DIR}/src/wasi-link.rsp ${CONFIGURATION_LINK_FLAGS} " RUNTIME_OUTPUT_DIRECTORY "${NATIVE_BIN_DIR}") -set(ignoreMeWasmOptFlags "${CONFIGURATION_WASM_OPT_FLAGS}${CMAKE_CXX_FLAGS}") +set(ignoreMeWasmOptFlags "${CONFIGURATION_WASM_OPT_FLAGS}${CMAKE_CXX_FLAGS}") #TODOWASI wasm-opt diff --git a/src/mono/wasm/runtime/CMakeLists.txt b/src/mono/wasm/runtime/CMakeLists.txt index dab32f84e060c2..26c3c7e25f8c3c 100644 --- a/src/mono/wasm/runtime/CMakeLists.txt +++ b/src/mono/wasm/runtime/CMakeLists.txt @@ -14,6 +14,7 @@ target_compile_options(dotnet PUBLIC @${NATIVE_BIN_DIR}/src/emcc-default.rsp @${ set_target_properties(dotnet PROPERTIES COMPILE_FLAGS ${CONFIGURATION_EMCC_FLAGS}) target_link_libraries(dotnet + PRIVATE ${ICU_LIB_DIR}/libicuuc.a ${ICU_LIB_DIR}/libicui18n.a ${MONO_ARTIFACTS_DIR}/libmono-component-hot_reload-static.a @@ -34,7 +35,7 @@ set_target_properties(dotnet PROPERTIES LINK_FLAGS "@${NATIVE_BIN_DIR}/src/emcc-default.rsp @${NATIVE_BIN_DIR}/src/emcc-link.rsp ${CONFIGURATION_LINK_FLAGS} --extern-pre-js ${NATIVE_BIN_DIR}/src/es6/runtime.es6.iffe.js --pre-js ${NATIVE_BIN_DIR}/src/es6/dotnet.es6.pre.js --js-library ${NATIVE_BIN_DIR}/src/es6/dotnet.es6.lib.js --js-library ${NATIVE_BIN_DIR}/src/pal_random.lib.js --post-js ${NATIVE_BIN_DIR}/src/es6/dotnet.es6.post.js --extern-post-js ${NATIVE_BIN_DIR}/src/es6/dotnet.es6.extpost.js " RUNTIME_OUTPUT_DIRECTORY "${NATIVE_BIN_DIR}") -set(ignoreMeWasmOptFlags "${CONFIGURATION_WASM_OPT_FLAGS}") +set(ignoreMeWasmOptFlags "${CONFIGURATION_WASM_OPT_FLAGS}") if(CMAKE_BUILD_TYPE STREQUAL "Release") add_custom_command(TARGET dotnet diff --git a/src/native/corehost/apphost/standalone/CMakeLists.txt b/src/native/corehost/apphost/standalone/CMakeLists.txt index ecd5ca0ca35964..a002464614770b 100644 --- a/src/native/corehost/apphost/standalone/CMakeLists.txt +++ b/src/native/corehost/apphost/standalone/CMakeLists.txt @@ -50,5 +50,5 @@ endif() # Specify non-default Windows libs to be used for Arm/Arm64 builds if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) - target_link_libraries(apphost shell32.lib) + target_link_libraries(apphost PRIVATE shell32.lib) endif() diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index 89c51af5645ddf..a40b88a8d012ae 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -233,6 +233,7 @@ set_property(TARGET singlefilehost PROPERTY ENABLE_EXPORTS 1) target_link_libraries( singlefilehost + PRIVATE ${NATIVE_LIBS} ${START_WHOLE_ARCHIVE} diff --git a/src/native/corehost/comhost/CMakeLists.txt b/src/native/corehost/comhost/CMakeLists.txt index 36251ad79598ba..9f777bff569974 100644 --- a/src/native/corehost/comhost/CMakeLists.txt +++ b/src/native/corehost/comhost/CMakeLists.txt @@ -38,8 +38,8 @@ if (CLR_CMAKE_TARGET_WIN32) list(APPEND WINLIBS Ole32.lib OleAut32.lib) endif() - target_link_libraries(comhost ${WINLIBS}) + target_link_libraries(comhost PRIVATE ${WINLIBS}) endif() install_with_stripped_symbols(comhost TARGETS corehost) -target_link_libraries(comhost libhostcommon) +target_link_libraries(comhost PRIVATE libhostcommon) diff --git a/src/native/corehost/common.cmake b/src/native/corehost/common.cmake index 717c3b5d89cf22..de14c1e0c853d4 100644 --- a/src/native/corehost/common.cmake +++ b/src/native/corehost/common.cmake @@ -38,19 +38,19 @@ function(set_common_libs TargetType) # Libraries used for exe projects if (${TargetType} STREQUAL "exe") if((CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD) AND NOT CLR_CMAKE_TARGET_ANDROID) - target_link_libraries (${DOTNET_PROJECT_NAME} "pthread") + target_link_libraries (${DOTNET_PROJECT_NAME} PRIVATE "pthread") endif() - target_link_libraries (${DOTNET_PROJECT_NAME} ${CMAKE_DL_LIBS}) + target_link_libraries (${DOTNET_PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS}) endif() if (NOT ${TargetType} STREQUAL "lib-static") # Specify the import library to link against for Arm32 build since the default set is minimal if (CLR_CMAKE_TARGET_ARCH_ARM) if (CLR_CMAKE_TARGET_WIN32) - target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib advapi32.lib) + target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE shell32.lib advapi32.lib) else() - target_link_libraries(${DOTNET_PROJECT_NAME} atomic.a) + target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE atomic.a) endif() endif() endif() diff --git a/src/native/corehost/fxr/standalone/CMakeLists.txt b/src/native/corehost/fxr/standalone/CMakeLists.txt index c594ad1d9266cf..a809a653cce18f 100644 --- a/src/native/corehost/fxr/standalone/CMakeLists.txt +++ b/src/native/corehost/fxr/standalone/CMakeLists.txt @@ -39,8 +39,8 @@ endif(CLR_CMAKE_HOST_UNIX) install_with_stripped_symbols(hostfxr TARGETS corehost) -target_link_libraries(hostfxr libhostcommon) +target_link_libraries(hostfxr PRIVATE libhostcommon) if (CLR_CMAKE_TARGET_ARCH_ARMV6) - target_link_libraries(${DOTNET_PROJECT_NAME} atomic) + target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE atomic) endif() diff --git a/src/native/corehost/hostpolicy/standalone/CMakeLists.txt b/src/native/corehost/hostpolicy/standalone/CMakeLists.txt index a0cbbe87f691d5..74bea97c58cc17 100644 --- a/src/native/corehost/hostpolicy/standalone/CMakeLists.txt +++ b/src/native/corehost/hostpolicy/standalone/CMakeLists.txt @@ -33,4 +33,4 @@ if(CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_UNIX) install_with_stripped_symbols(hostpolicy TARGETS corehost) -target_link_libraries(hostpolicy libhostcommon) +target_link_libraries(hostpolicy PRIVATE libhostcommon) diff --git a/src/native/corehost/ijwhost/CMakeLists.txt b/src/native/corehost/ijwhost/CMakeLists.txt index 036ae1d386e4c9..6a4fdbb4d4ce1d 100644 --- a/src/native/corehost/ijwhost/CMakeLists.txt +++ b/src/native/corehost/ijwhost/CMakeLists.txt @@ -49,7 +49,7 @@ include(../lib.cmake) # Specify non-default Windows libs to be used for Arm/Arm64 builds if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) - target_link_libraries(ijwhost Ole32.lib) + target_link_libraries(ijwhost PRIVATE Ole32.lib) endif() install_with_stripped_symbols(ijwhost TARGETS corehost) diff --git a/src/native/corehost/test/comsxs/CMakeLists.txt b/src/native/corehost/test/comsxs/CMakeLists.txt index f24ca824215e9e..673e7f07bdde0e 100644 --- a/src/native/corehost/test/comsxs/CMakeLists.txt +++ b/src/native/corehost/test/comsxs/CMakeLists.txt @@ -13,6 +13,6 @@ set(SOURCES include(../testexe.cmake) -target_link_libraries(comsxs ole32 oleaut32) +target_link_libraries(comsxs PRIVATE ole32 oleaut32) install_with_stripped_symbols(comsxs TARGETS corehost_test) diff --git a/src/native/corehost/test/fx_ver/CMakeLists.txt b/src/native/corehost/test/fx_ver/CMakeLists.txt index e2849e9dddce57..ed39b965966c6a 100644 --- a/src/native/corehost/test/fx_ver/CMakeLists.txt +++ b/src/native/corehost/test/fx_ver/CMakeLists.txt @@ -15,4 +15,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../hostmisc/hostmisc.cmake) include(../testexe.cmake) -target_link_libraries(${DOTNET_PROJECT_NAME} libhostcommon) +target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE libhostcommon) diff --git a/src/native/corehost/test/ijw/CMakeLists.txt b/src/native/corehost/test/ijw/CMakeLists.txt index d360314fb7fa1b..e9f43e23712693 100644 --- a/src/native/corehost/test/ijw/CMakeLists.txt +++ b/src/native/corehost/test/ijw/CMakeLists.txt @@ -9,8 +9,8 @@ set(SOURCES include(${CLR_ENG_NATIVE_DIR}/ijw/IJW.cmake) add_library(ijw SHARED ${SOURCES}) -target_link_libraries(ijw ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(ijw PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) remove_ijw_incompatible_target_options(ijw) -install_with_stripped_symbols(ijw TARGETS corehost_test) \ No newline at end of file +install_with_stripped_symbols(ijw TARGETS corehost_test) diff --git a/src/native/corehost/test/nativehost/CMakeLists.txt b/src/native/corehost/test/nativehost/CMakeLists.txt index d8b23ca12ce568..527ab578d39916 100644 --- a/src/native/corehost/test/nativehost/CMakeLists.txt +++ b/src/native/corehost/test/nativehost/CMakeLists.txt @@ -48,17 +48,17 @@ include(../../hostmisc/hostmisc.cmake) include(../testexe.cmake) -target_link_libraries(${DOTNET_PROJECT_NAME} nethost) +target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE nethost) if (CLR_CMAKE_TARGET_WIN32) - target_link_libraries(${DOTNET_PROJECT_NAME} delayimp.lib) + target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE delayimp.lib) endif() # Specify non-default Windows libs to be used for Arm/Arm64 builds if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) - target_link_libraries(${DOTNET_PROJECT_NAME} Ole32.lib OleAut32.lib) + target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE Ole32.lib OleAut32.lib) endif() if (CLR_CMAKE_TARGET_ARCH_ARMV6) - target_link_libraries(${DOTNET_PROJECT_NAME} atomic) + target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE atomic) endif() diff --git a/src/native/libs/System.Globalization.Native/CMakeLists.txt b/src/native/libs/System.Globalization.Native/CMakeLists.txt index bbf9737d6e135d..6f00d2fad2f3eb 100644 --- a/src/native/libs/System.Globalization.Native/CMakeLists.txt +++ b/src/native/libs/System.Globalization.Native/CMakeLists.txt @@ -105,6 +105,7 @@ if (GEN_SHARED_LIB) ) target_link_libraries(System.Globalization.Native + PRIVATE dl ${FOUNDATION} ) @@ -150,9 +151,6 @@ if(CLR_CMAKE_TARGET_WIN32) ) target_compile_options(System.Globalization.Native.Aot.GuardCF PRIVATE /GL-) - target_link_libraries(System.Globalization.Native.Aot ${__LinkLibraries}) - target_link_libraries(System.Globalization.Native.Aot.GuardCF ${__LinkLibraries}) - install_static_library(System.Globalization.Native.Aot aotsdk nativeaot) install_static_library(System.Globalization.Native.Aot.GuardCF aotsdk nativeaot) endif() diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index a2fe7605b47eae..845c09097f7745 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -60,6 +60,7 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) ) target_link_libraries(System.IO.Compression.Native + PRIVATE ${NATIVE_LIBS_EXTRA} ) @@ -144,17 +145,6 @@ else () target_compile_options(System.IO.Compression.Native.Aot.GuardCF PRIVATE /GL-) endif() - # Allow specification of libraries that should be linked against - if (GEN_SHARED_LIB) - target_link_libraries(System.IO.Compression.Native ${__LinkLibraries}) - endif () - target_link_libraries(System.IO.Compression.Native-Static ${__LinkLibraries}) - - if(STATIC_LIBS_ONLY) - target_link_libraries(System.IO.Compression.Native.Aot ${__LinkLibraries}) - target_link_libraries(System.IO.Compression.Native.Aot.GuardCF ${__LinkLibraries}) - endif() - if (GEN_SHARED_LIB) GENERATE_EXPORT_HEADER( System.IO.Compression.Native BASE_NAME System.IO.Compression.Native diff --git a/src/native/libs/System.Native/CMakeLists.txt b/src/native/libs/System.Native/CMakeLists.txt index d44823c951354c..834221a844b675 100644 --- a/src/native/libs/System.Native/CMakeLists.txt +++ b/src/native/libs/System.Native/CMakeLists.txt @@ -124,6 +124,7 @@ if (GEN_SHARED_LIB) ) target_link_libraries(System.Native + PRIVATE ${NATIVE_LIBS_EXTRA} ) diff --git a/src/native/libs/System.Net.Security.Native/CMakeLists.txt b/src/native/libs/System.Net.Security.Native/CMakeLists.txt index 50c9228fe3dd34..b0e02f41509b58 100644 --- a/src/native/libs/System.Net.Security.Native/CMakeLists.txt +++ b/src/native/libs/System.Net.Security.Native/CMakeLists.txt @@ -32,6 +32,7 @@ set_target_properties(System.Net.Security.Native-Static PROPERTIES OUTPUT_NAME S if (GEN_SHARED_LIB) target_link_libraries(System.Net.Security.Native + PRIVATE ${NATIVE_LIBS_EXTRA} ) diff --git a/src/native/libs/System.Security.Cryptography.Native.Android/CMakeLists.txt b/src/native/libs/System.Security.Cryptography.Native.Android/CMakeLists.txt index 36a0827e25d13c..76c93faf093f0e 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Android/CMakeLists.txt +++ b/src/native/libs/System.Security.Cryptography.Native.Android/CMakeLists.txt @@ -44,6 +44,7 @@ add_library(System.Security.Cryptography.Native.Android-Static set_target_properties(System.Security.Cryptography.Native.Android-Static PROPERTIES OUTPUT_NAME System.Security.Cryptography.Native.Android CLEAN_DIRECT_OUTPUT 1) target_link_libraries(System.Security.Cryptography.Native.Android + PRIVATE -llog ) diff --git a/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt index 92db54849fa460..b847f5c3cd68b9 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -90,6 +90,7 @@ set_target_properties(System.Security.Cryptography.Native.Apple-Static PROPERTIE if (GEN_SHARED_LIB) target_link_libraries(System.Security.Cryptography.Native.Apple + PRIVATE ${NATIVE_LIBS_EXTRA} ) diff --git a/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt b/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt index 7278e31ca60dbb..1b066e554ffe37 100644 --- a/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt +++ b/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt @@ -126,6 +126,7 @@ if (GEN_SHARED_LIB) endif() target_link_libraries(System.Security.Cryptography.Native.OpenSsl + PRIVATE ${NATIVE_LIBS_EXTRA} ) endif() diff --git a/src/tests/Interop/ArrayMarshalling/BoolArray/CMakeLists.txt b/src/tests/Interop/ArrayMarshalling/BoolArray/CMakeLists.txt index 50a43d1ffac680..47a1e9189dd06f 100644 --- a/src/tests/Interop/ArrayMarshalling/BoolArray/CMakeLists.txt +++ b/src/tests/Interop/ArrayMarshalling/BoolArray/CMakeLists.txt @@ -1,10 +1,10 @@ project (MarshalBoolArrayNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES MarshalBoolArrayNative.cpp) # add the executable add_library (MarshalBoolArrayNative SHARED ${SOURCES}) -target_link_libraries(MarshalBoolArrayNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(MarshalBoolArrayNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS MarshalBoolArrayNative DESTINATION bin) diff --git a/src/tests/Interop/ArrayMarshalling/SafeArray/CMakeLists.txt b/src/tests/Interop/ArrayMarshalling/SafeArray/CMakeLists.txt index 3c28de43313660..711e43d181dceb 100644 --- a/src/tests/Interop/ArrayMarshalling/SafeArray/CMakeLists.txt +++ b/src/tests/Interop/ArrayMarshalling/SafeArray/CMakeLists.txt @@ -1,10 +1,10 @@ project (SafeArrayNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES SafeArrayNative.cpp RecordNative.cpp) # add the executable add_library (SafeArrayNative SHARED ${SOURCES}) -target_link_libraries(SafeArrayNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(SafeArrayNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS SafeArrayNative DESTINATION bin) diff --git a/src/tests/Interop/BestFitMapping/CMakeLists.txt b/src/tests/Interop/BestFitMapping/CMakeLists.txt index 05f50045072a1e..a9f2700c79dae5 100644 --- a/src/tests/Interop/BestFitMapping/CMakeLists.txt +++ b/src/tests/Interop/BestFitMapping/CMakeLists.txt @@ -1,10 +1,10 @@ project (BestFitMappingNative) set(SOURCES BestFitMappingNative.cpp ) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (BestFitMappingNative SHARED ${SOURCES}) -target_link_libraries(BestFitMappingNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(BestFitMappingNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS BestFitMappingNative DESTINATION bin) diff --git a/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/CMakeLists.txt b/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/CMakeLists.txt index fb232b99da3e17..ec0104a9d381e2 100644 --- a/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/CMakeLists.txt +++ b/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES ReferenceTrackerRuntime.cpp) # add the shared library add_library (MockReferenceTrackerRuntime SHARED ${SOURCES}) -target_link_libraries(MockReferenceTrackerRuntime ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(MockReferenceTrackerRuntime PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS MockReferenceTrackerRuntime DESTINATION bin) diff --git a/src/tests/Interop/COM/ComWrappers/WeakReference/CMakeLists.txt b/src/tests/Interop/COM/ComWrappers/WeakReference/CMakeLists.txt index 8166db21865745..25c32ec842ac0e 100644 --- a/src/tests/Interop/COM/ComWrappers/WeakReference/CMakeLists.txt +++ b/src/tests/Interop/COM/ComWrappers/WeakReference/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES WeakReferenceNative.cpp) # add the shared library add_library (WeakReferenceNative SHARED ${SOURCES}) -target_link_libraries(WeakReferenceNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(WeakReferenceNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS WeakReferenceNative DESTINATION bin) diff --git a/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt b/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt index 51c8ecd4aed44a..befba2383cee81 100644 --- a/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt +++ b/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt @@ -34,7 +34,7 @@ endif() # add the shared library add_library (${PROJECT_NAME} SHARED ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy manifest file to project output file(GENERATE OUTPUT $/DynamicTestServer.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/DynamicTestServer.X.manifest) diff --git a/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt index 32e15944b3dc68..8338be8220d4e0 100644 --- a/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt +++ b/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt @@ -9,7 +9,7 @@ set(SOURCES # add the executable add_executable (COMClientDefaultInterfaces ${SOURCES}) -target_link_libraries(COMClientDefaultInterfaces ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(COMClientDefaultInterfaces PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy CoreShim manifest to project output file(GENERATE OUTPUT $/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest) diff --git a/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt index 199de322864042..a3e35c353582f2 100644 --- a/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt +++ b/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt @@ -8,7 +8,7 @@ set(SOURCES # add the executable add_executable (COMClientDispatch ${SOURCES}) -target_link_libraries(COMClientDispatch ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(COMClientDispatch PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy CoreShim manifest to project output file(GENERATE OUTPUT $/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest) diff --git a/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt index 74967098ff9ae4..1443b6203727de 100644 --- a/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt +++ b/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt @@ -9,7 +9,7 @@ set(SOURCES # add the executable add_executable (COMClientEvents ${SOURCES}) -target_link_libraries(COMClientEvents ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(COMClientEvents PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy CoreShim manifest to project output file(GENERATE OUTPUT $/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest) diff --git a/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt index 1ee5d029135ce4..ac9640e230f336 100644 --- a/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt +++ b/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt @@ -9,7 +9,7 @@ set(SOURCES # add the executable add_executable (COMClientLicensing ${SOURCES}) -target_link_libraries(COMClientLicensing ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(COMClientLicensing PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy CoreShim manifest to project output file(GENERATE OUTPUT $/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest) diff --git a/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt index 58d45078152092..0fcfe6dcce98d3 100644 --- a/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt +++ b/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt @@ -14,7 +14,7 @@ set(SOURCES # add the executable add_executable (COMClientPrimitives ${SOURCES}) -target_link_libraries(COMClientPrimitives ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(COMClientPrimitives PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy CoreShim manifest to project output file(GENERATE OUTPUT $/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest) diff --git a/src/tests/Interop/COM/NativeServer/CMakeLists.txt b/src/tests/Interop/COM/NativeServer/CMakeLists.txt index 1f757d8e9cdf6c..33d81d4ee4ce68 100644 --- a/src/tests/Interop/COM/NativeServer/CMakeLists.txt +++ b/src/tests/Interop/COM/NativeServer/CMakeLists.txt @@ -10,7 +10,7 @@ endif() # add the shared library add_library (COMNativeServer SHARED ${SOURCES}) -target_link_libraries(COMNativeServer ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(COMNativeServer PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # Copy manifest file to project output file(GENERATE OUTPUT $/COMNativeServer.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/COMNativeServer.X.manifest) diff --git a/src/tests/Interop/DisabledRuntimeMarshalling/CMakeLists.txt b/src/tests/Interop/DisabledRuntimeMarshalling/CMakeLists.txt index 018819bf330730..20c98adc3cd431 100644 --- a/src/tests/Interop/DisabledRuntimeMarshalling/CMakeLists.txt +++ b/src/tests/Interop/DisabledRuntimeMarshalling/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES DisabledRuntimeMarshallingNative.cpp ) # add the executable add_library (DisabledRuntimeMarshallingNative SHARED ${SOURCES}) -target_link_libraries(DisabledRuntimeMarshallingNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DisabledRuntimeMarshallingNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS DisabledRuntimeMarshallingNative DESTINATION bin) diff --git a/src/tests/Interop/DllImportAttribute/DllImportPath/CMakeLists.txt b/src/tests/Interop/DllImportAttribute/DllImportPath/CMakeLists.txt index ad67362d08a27e..6718e38aa0f9e1 100644 --- a/src/tests/Interop/DllImportAttribute/DllImportPath/CMakeLists.txt +++ b/src/tests/Interop/DllImportAttribute/DllImportPath/CMakeLists.txt @@ -1,25 +1,25 @@ -project (DllImportPath) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - DllImportPathNative.cpp -) +project (DllImportPath) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + DllImportPathNative.cpp +) -# Additional files to reference: -# add the executable +# Additional files to reference: +# add the executable add_library (DllImportPath_Local SHARED ${SOURCES}) add_library (DllImportPath.Local SHARED ${SOURCES}) add_library (DllImportPath_PathEnv SHARED ${SOURCES}) add_library (DllImportPath_Relative SHARED ${SOURCES}) add_executable(DllImportPath_ExeFile ${SOURCES}) -target_link_libraries(DllImportPath_Local ${LINK_LIBRARIES_ADDITIONAL}) -target_link_libraries(DllImportPath.Local ${LINK_LIBRARIES_ADDITIONAL}) -target_link_libraries(DllImportPath_PathEnv ${LINK_LIBRARIES_ADDITIONAL}) -target_link_libraries(DllImportPath_Relative ${LINK_LIBRARIES_ADDITIONAL}) -target_link_libraries(DllImportPath_ExeFile ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DllImportPath_Local PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DllImportPath.Local PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DllImportPath_PathEnv PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DllImportPath_Relative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DllImportPath_ExeFile PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) target_compile_definitions(DllImportPath_ExeFile PRIVATE EXE) -# add the install targets -install (TARGETS DllImportPath_Local DESTINATION bin) -install (TARGETS DllImportPath.Local DESTINATION bin) -install (TARGETS DllImportPath_PathEnv DESTINATION bin) -install (TARGETS DllImportPath_Relative DESTINATION bin) +# add the install targets +install (TARGETS DllImportPath_Local DESTINATION bin) +install (TARGETS DllImportPath.Local DESTINATION bin) +install (TARGETS DllImportPath_PathEnv DESTINATION bin) +install (TARGETS DllImportPath_Relative DESTINATION bin) diff --git a/src/tests/Interop/DllImportAttribute/ExactSpelling/CMakeLists.txt b/src/tests/Interop/DllImportAttribute/ExactSpelling/CMakeLists.txt index 87309b6edc9577..c491fd782cd398 100644 --- a/src/tests/Interop/DllImportAttribute/ExactSpelling/CMakeLists.txt +++ b/src/tests/Interop/DllImportAttribute/ExactSpelling/CMakeLists.txt @@ -1,11 +1,11 @@ project (ExactSpellingNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES ExactSpellingNative.cpp) # add the executable add_library (ExactSpellingNative SHARED ${SOURCES}) -target_link_libraries(ExactSpellingNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(ExactSpellingNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS ExactSpellingNative DESTINATION bin) diff --git a/src/tests/Interop/ExecInDefAppDom/CMakeLists.txt b/src/tests/Interop/ExecInDefAppDom/CMakeLists.txt index 206a58dc1ca597..4287e19d5c8a1e 100644 --- a/src/tests/Interop/ExecInDefAppDom/CMakeLists.txt +++ b/src/tests/Interop/ExecInDefAppDom/CMakeLists.txt @@ -1,10 +1,10 @@ project (ExecInDefAppDomDll) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES ExecInDefAppDomDll.cpp ) # add the executable add_library (ExecInDefAppDomDll SHARED ${SOURCES}) -target_link_libraries(ExecInDefAppDomDll ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(ExecInDefAppDomDll PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS ExecInDefAppDomDll DESTINATION bin) diff --git a/src/tests/Interop/FuncPtrAsDelegateParam/CMakeLists.txt b/src/tests/Interop/FuncPtrAsDelegateParam/CMakeLists.txt index db130523bf1d51..0193a5357ea739 100644 --- a/src/tests/Interop/FuncPtrAsDelegateParam/CMakeLists.txt +++ b/src/tests/Interop/FuncPtrAsDelegateParam/CMakeLists.txt @@ -1,10 +1,10 @@ project (FuncPtrAsDelegateParamNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES FuncPtrAsDelegateParamNative.cpp ) # add the executable add_library (FuncPtrAsDelegateParamNative SHARED ${SOURCES}) -target_link_libraries(FuncPtrAsDelegateParamNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(FuncPtrAsDelegateParamNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS FuncPtrAsDelegateParamNative DESTINATION bin) diff --git a/src/tests/Interop/ICustomMarshaler/ConflictingNames/CMakeLists.txt b/src/tests/Interop/ICustomMarshaler/ConflictingNames/CMakeLists.txt index b9b2343e648ae5..3aa29f7767334e 100644 --- a/src/tests/Interop/ICustomMarshaler/ConflictingNames/CMakeLists.txt +++ b/src/tests/Interop/ICustomMarshaler/ConflictingNames/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES CustomMarshalerNative.cpp ) # add the executable add_library (CustomMarshalerNative SHARED ${SOURCES}) -target_link_libraries(CustomMarshalerNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(CustomMarshalerNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS CustomMarshalerNative DESTINATION bin) diff --git a/src/tests/Interop/ICustomMarshaler/Primitives/CMakeLists.txt b/src/tests/Interop/ICustomMarshaler/Primitives/CMakeLists.txt index 1264ebcf0a2252..c539029f79c87e 100644 --- a/src/tests/Interop/ICustomMarshaler/Primitives/CMakeLists.txt +++ b/src/tests/Interop/ICustomMarshaler/Primitives/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES ICustomMarshalerNative.cpp ) # add the executable add_library (CustomMarshalersPrimitives SHARED ${SOURCES}) -target_link_libraries(CustomMarshalersPrimitives ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(CustomMarshalersPrimitives PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS CustomMarshalersPrimitives DESTINATION bin) diff --git a/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt b/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt index 92085fcc778acd..3f9c1d9b727e80 100644 --- a/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt +++ b/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt @@ -6,7 +6,7 @@ set(SOURCES IjwCopyConstructorMarshaler.cpp) # add the shared library add_library (IjwCopyConstructorMarshaler SHARED ${SOURCES}) -target_link_libraries(IjwCopyConstructorMarshaler ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(IjwCopyConstructorMarshaler PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS IjwCopyConstructorMarshaler DESTINATION bin) diff --git a/src/tests/Interop/IJW/IjwNativeCallingManagedDll/CMakeLists.txt b/src/tests/Interop/IJW/IjwNativeCallingManagedDll/CMakeLists.txt index a51468b6046261..e29fbfeae3668e 100644 --- a/src/tests/Interop/IJW/IjwNativeCallingManagedDll/CMakeLists.txt +++ b/src/tests/Interop/IJW/IjwNativeCallingManagedDll/CMakeLists.txt @@ -6,7 +6,7 @@ set(SOURCES IjwNativeCallingManagedDll.cpp) # add the shared library add_library (IjwNativeCallingManagedDll SHARED ${SOURCES}) -target_link_libraries(IjwNativeCallingManagedDll ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(IjwNativeCallingManagedDll PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS IjwNativeCallingManagedDll DESTINATION bin) diff --git a/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt b/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt index 93d8a676af254f..c588e57b44db5f 100644 --- a/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt +++ b/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt @@ -6,7 +6,7 @@ set(SOURCES IjwNativeDll.cpp) # add the shared library add_library (IjwNativeDll SHARED ${SOURCES}) -target_link_libraries(IjwNativeDll ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(IjwNativeDll PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS IjwNativeDll DESTINATION bin) diff --git a/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt b/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt index 5427431a31a381..17929bffd9402e 100644 --- a/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt +++ b/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt @@ -6,7 +6,7 @@ set(SOURCES IjwNativeVarargs.cpp) # add the shared library add_library (IjwNativeVarargs SHARED ${SOURCES}) -target_link_libraries(IjwNativeVarargs ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(IjwNativeVarargs PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS IjwNativeVarargs DESTINATION bin) diff --git a/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt b/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt index b6bbd047ab37f0..db5aa92b2e8a8b 100644 --- a/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt +++ b/src/tests/Interop/IJW/ijwhostmock/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES ijwhost.cpp) # add the shared library add_library (ijwhost SHARED ${SOURCES}) -target_link_libraries(ijwhost ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(ijwhost PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS ijwhost DESTINATION bin) diff --git a/src/tests/Interop/LayoutClass/CMakeLists.txt b/src/tests/Interop/LayoutClass/CMakeLists.txt index fa4dab93391938..5f5cfe660501f8 100644 --- a/src/tests/Interop/LayoutClass/CMakeLists.txt +++ b/src/tests/Interop/LayoutClass/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES LayoutClassNative.cpp ) # add the executable add_library (LayoutClassNative SHARED ${SOURCES}) -target_link_libraries(LayoutClassNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(LayoutClassNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS LayoutClassNative DESTINATION bin) diff --git a/src/tests/Interop/MarshalAPI/FunctionPointer/CMakeLists.txt b/src/tests/Interop/MarshalAPI/FunctionPointer/CMakeLists.txt index 1455eadd733117..549f9dfcab606b 100644 --- a/src/tests/Interop/MarshalAPI/FunctionPointer/CMakeLists.txt +++ b/src/tests/Interop/MarshalAPI/FunctionPointer/CMakeLists.txt @@ -1,10 +1,10 @@ project (FunctionPointerNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES FunctionPointerNative.cpp) # add the executable add_library (FunctionPointerNative SHARED ${SOURCES}) -target_link_libraries(FunctionPointerNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(FunctionPointerNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS FunctionPointerNative DESTINATION bin) diff --git a/src/tests/Interop/MarshalAPI/IUnknown/CMakeLists.txt b/src/tests/Interop/MarshalAPI/IUnknown/CMakeLists.txt index 233055eb0d5cb1..6c6400c297127b 100644 --- a/src/tests/Interop/MarshalAPI/IUnknown/CMakeLists.txt +++ b/src/tests/Interop/MarshalAPI/IUnknown/CMakeLists.txt @@ -1,10 +1,10 @@ project (IUnknownNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES IUnknownNative.cpp) # add the executable add_library (IUnknownNative SHARED ${SOURCES}) -target_link_libraries(IUnknownNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(IUnknownNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS IUnknownNative DESTINATION bin) diff --git a/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt b/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt index eb1fb234a2bcc5..d8eca7104e6303 100644 --- a/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt +++ b/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt @@ -8,7 +8,7 @@ add_subdirectory(${CLR_SRC_NATIVE_DIR}/public public_api) # add the library add_library (mono-embedding-api-test SHARED mono-embedding-api-test.c api-types.h api-functions.h) set_target_properties(mono-embedding-api-test PROPERTIES MSVC_WARNING_LEVEL 3) -target_link_libraries(mono-embedding-api-test monoapi ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(mono-embedding-api-test PRIVATE monoapi ${LINK_LIBRARIES_ADDITIONAL}) if(CLR_CMAKE_HOST_OSX) target_compile_definitions(mono-embedding-api-test PRIVATE -DHOST_DARWIN) diff --git a/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/CMakeLists.txt b/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/CMakeLists.txt index 89cae1fd0d9c4d..f64e2e89bf7b90 100644 --- a/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/CMakeLists.txt +++ b/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/CMakeLists.txt @@ -5,12 +5,12 @@ include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") add_library (NativeLibrary SHARED NativeLibrary.cpp) if (CLR_CMAKE_TARGET_UNIX) - target_link_libraries(NativeLibrary ${LINK_LIBRARIES_ADDITIONAL}) + target_link_libraries(NativeLibrary PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) endif() # add the shared library add_library (GlobalLoadHelper SHARED GlobalLoadHelper.cpp) -target_link_libraries(GlobalLoadHelper ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(GlobalLoadHelper PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) add_library (GloballyLoadedNativeLibrary SHARED GloballyLoadedNativeLibrary.cpp) -target_link_libraries(GloballyLoadedNativeLibrary ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(GloballyLoadedNativeLibrary PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) diff --git a/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt b/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt index 26d1f2e7c8f38d..734002e46bf1fe 100644 --- a/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt +++ b/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(CMAKE_OBJC_STANDARD 99) set(CMAKE_OBJC_STANDARD_REQUIRED TRUE) @@ -19,4 +19,4 @@ include(CMakeFindFrameworks) find_library(FOUNDATION Foundation REQUIRED) add_library(ObjectiveC SHARED ${SOURCES}) -target_link_libraries(ObjectiveC ${FOUNDATION}) +target_link_libraries(ObjectiveC PRIVATE ${FOUNDATION}) diff --git a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt index 9ff79679f4ab85..85baca869c9d45 100644 --- a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt +++ b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt @@ -10,7 +10,7 @@ set(SOURCES NativeObjCMarshalTests.cpp) # add the shared library add_library (NativeObjCMarshalTests SHARED ${SOURCES}) -target_link_libraries(NativeObjCMarshalTests ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(NativeObjCMarshalTests PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS NativeObjCMarshalTests DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/CMakeLists.txt b/src/tests/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/CMakeLists.txt index 325aba26bc0060..445d7c894c929c 100644 --- a/src/tests/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/CMakeLists.txt @@ -1,14 +1,14 @@ - -project (MarshalArrayByValArrayNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") + +project (MarshalArrayByValArrayNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") include_directories("../..") -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - MarshalArrayByValArrayNative.cpp -) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + MarshalArrayByValArrayNative.cpp +) -# add the executable -add_library (MarshalArrayByValArrayNative SHARED ${SOURCES}) -target_link_libraries(MarshalArrayByValArrayNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS MarshalArrayByValArrayNative DESTINATION bin) +# add the executable +add_library (MarshalArrayByValArrayNative SHARED ${SOURCES}) +target_link_libraries(MarshalArrayByValArrayNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS MarshalArrayByValArrayNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Array/MarshalArrayAsParam/LPArrayNative/CMakeLists.txt b/src/tests/Interop/PInvoke/Array/MarshalArrayAsParam/LPArrayNative/CMakeLists.txt index 8c4e61381f9598..e5a9e42bdf9f25 100644 --- a/src/tests/Interop/PInvoke/Array/MarshalArrayAsParam/LPArrayNative/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Array/MarshalArrayAsParam/LPArrayNative/CMakeLists.txt @@ -1,13 +1,13 @@ - -project (MarshalArrayLPArrayNative) + +project (MarshalArrayLPArrayNative) include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") include_directories("../..") -set(SOURCES - MarshalArrayLPArrayNative.cpp -) +set(SOURCES + MarshalArrayLPArrayNative.cpp +) -# add the executable +# add the executable add_library (MarshalArrayLPArrayNative SHARED ${SOURCES}) -target_link_libraries(MarshalArrayLPArrayNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS MarshalArrayLPArrayNative DESTINATION bin) +target_link_libraries(MarshalArrayLPArrayNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS MarshalArrayLPArrayNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/ArrayWithOffset/CMakeLists.txt b/src/tests/Interop/PInvoke/ArrayWithOffset/CMakeLists.txt index 5b8bf6ccb97778..395b2013e137e8 100644 --- a/src/tests/Interop/PInvoke/ArrayWithOffset/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/ArrayWithOffset/CMakeLists.txt @@ -10,6 +10,6 @@ if(CLR_CMAKE_HOST_WIN32) endif(CLR_CMAKE_HOST_WIN32) # add the executable add_library (ArrayWithOffsetNative SHARED ${SOURCES}) -target_link_libraries(ArrayWithOffsetNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(ArrayWithOffsetNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS ArrayWithOffsetNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/AsAny/CMakeLists.txt b/src/tests/Interop/PInvoke/AsAny/CMakeLists.txt index 0a284e2af11bd1..fab42ef717cabc 100644 --- a/src/tests/Interop/PInvoke/AsAny/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/AsAny/CMakeLists.txt @@ -10,6 +10,6 @@ if(CLR_CMAKE_HOST_WIN32) endif(CLR_CMAKE_HOST_WIN32) # add the executable add_library (AsAnyNative SHARED ${SOURCES}) -target_link_libraries(AsAnyNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(AsAnyNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS AsAnyNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Attributes/LCID/CMakeLists.txt b/src/tests/Interop/PInvoke/Attributes/LCID/CMakeLists.txt index 5ea33f134bef11..bd6556422c91f0 100644 --- a/src/tests/Interop/PInvoke/Attributes/LCID/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Attributes/LCID/CMakeLists.txt @@ -1,9 +1,9 @@ -project (LCIDNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - LCIDNative.cpp -) -add_library (LCIDNative SHARED ${SOURCES}) -target_link_libraries(LCIDNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS LCIDNative DESTINATION bin) +project (LCIDNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + LCIDNative.cpp +) +add_library (LCIDNative SHARED ${SOURCES}) +target_link_libraries(LCIDNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS LCIDNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/BestFitMapping/Char/CMakeLists.txt b/src/tests/Interop/PInvoke/BestFitMapping/Char/CMakeLists.txt index 72c385ba3cf4e3..af0dd5f83e99f1 100644 --- a/src/tests/Interop/PInvoke/BestFitMapping/Char/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/BestFitMapping/Char/CMakeLists.txt @@ -1,10 +1,10 @@ - -project (Char_BestFitMappingNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - BestFitMappingNative.cpp -) -add_library (Char_BestFitMappingNative SHARED ${SOURCES}) -target_link_libraries(Char_BestFitMappingNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS Char_BestFitMappingNative DESTINATION bin) + +project (Char_BestFitMappingNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + BestFitMappingNative.cpp +) +add_library (Char_BestFitMappingNative SHARED ${SOURCES}) +target_link_libraries(Char_BestFitMappingNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS Char_BestFitMappingNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/BestFitMapping/LPStr/CMakeLists.txt b/src/tests/Interop/PInvoke/BestFitMapping/LPStr/CMakeLists.txt index c345e1b6354fa9..a2802113f30163 100644 --- a/src/tests/Interop/PInvoke/BestFitMapping/LPStr/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/BestFitMapping/LPStr/CMakeLists.txt @@ -1,11 +1,11 @@ - -project (LPStr_BestFitMappingNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - BestFitMappingNative.cpp -) -add_library (LPStr_BestFitMappingNative SHARED ${SOURCES}) -target_link_libraries(LPStr_BestFitMappingNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS LPStr_BestFitMappingNative DESTINATION bin) +project (LPStr_BestFitMappingNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + BestFitMappingNative.cpp +) + +add_library (LPStr_BestFitMappingNative SHARED ${SOURCES}) +target_link_libraries(LPStr_BestFitMappingNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS LPStr_BestFitMappingNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/CriticalHandles/CMakeLists.txt b/src/tests/Interop/PInvoke/CriticalHandles/CMakeLists.txt index e57c7146a5bc5a..ce827099c4d7bd 100644 --- a/src/tests/Interop/PInvoke/CriticalHandles/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/CriticalHandles/CMakeLists.txt @@ -1,11 +1,11 @@ - -project (CriticalHandlesNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - CriticalHandlesNative.cpp -) -# add the executable -add_library (CriticalHandlesNative SHARED ${SOURCES}) -target_link_libraries(CriticalHandlesNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS CriticalHandlesNative DESTINATION bin) + +project (CriticalHandlesNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + CriticalHandlesNative.cpp +) +# add the executable +add_library (CriticalHandlesNative SHARED ${SOURCES}) +target_link_libraries(CriticalHandlesNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS CriticalHandlesNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/CustomMarshalers/CMakeLists.txt b/src/tests/Interop/PInvoke/CustomMarshalers/CMakeLists.txt index 6535bc389488aa..31c3fc87be7d7b 100644 --- a/src/tests/Interop/PInvoke/CustomMarshalers/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/CustomMarshalers/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES CustomMarshalersNative.cpp ) # add the executable add_library (CustomMarshalersNative SHARED ${SOURCES}) -target_link_libraries(CustomMarshalersNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(CustomMarshalersNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS CustomMarshalersNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/DateTime/CMakeLists.txt b/src/tests/Interop/PInvoke/DateTime/CMakeLists.txt index 6b3018ac44e6dc..6010a0b00d57e4 100644 --- a/src/tests/Interop/PInvoke/DateTime/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/DateTime/CMakeLists.txt @@ -1,10 +1,10 @@ -project (NativeDateTime) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - NativeDateTime.cpp +project (NativeDateTime) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + NativeDateTime.cpp ) -# add the executable -add_library (NativeDateTime SHARED ${SOURCES}) -target_link_libraries(NativeDateTime ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS NativeDateTime DESTINATION bin) +# add the executable +add_library (NativeDateTime SHARED ${SOURCES}) +target_link_libraries(NativeDateTime PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS NativeDateTime DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Decimal/CMakeLists.txt b/src/tests/Interop/PInvoke/Decimal/CMakeLists.txt index 1ea463f5936758..cad9c50f07f6e0 100644 --- a/src/tests/Interop/PInvoke/Decimal/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Decimal/CMakeLists.txt @@ -1,8 +1,8 @@ - -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - DecimalTestNative.cpp + +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + DecimalTestNative.cpp ) -add_library (DecimalTestNative SHARED ${SOURCES}) -target_link_libraries(DecimalTestNative ${LINK_LIBRARIES_ADDITIONAL}) -install (TARGETS DecimalTestNative DESTINATION bin) +add_library (DecimalTestNative SHARED ${SOURCES}) +target_link_libraries(DecimalTestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +install (TARGETS DecimalTestNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Delegate/CMakeLists.txt b/src/tests/Interop/PInvoke/Delegate/CMakeLists.txt index a1d69cbceb22f9..92aaf73d67931f 100644 --- a/src/tests/Interop/PInvoke/Delegate/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Delegate/CMakeLists.txt @@ -10,4 +10,4 @@ endif() # add the executable add_library (DelegateTestNative SHARED ${SOURCES}) -target_link_libraries(DelegateTestNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(DelegateTestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) diff --git a/src/tests/Interop/PInvoke/IEnumerator/CMakeLists.txt b/src/tests/Interop/PInvoke/IEnumerator/CMakeLists.txt index 41b3799675d1cf..0c303cfc982763 100644 --- a/src/tests/Interop/PInvoke/IEnumerator/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/IEnumerator/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES IEnumeratorNative.cpp ) # add the executable add_library (IEnumeratorNative SHARED ${SOURCES}) -target_link_libraries(IEnumeratorNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(IEnumeratorNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS IEnumeratorNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/SafeHandles/CMakeLists.txt b/src/tests/Interop/PInvoke/SafeHandles/CMakeLists.txt index 5ebde4def44cdd..da7391f4035305 100644 --- a/src/tests/Interop/PInvoke/SafeHandles/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/SafeHandles/CMakeLists.txt @@ -1,8 +1,8 @@ - -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - SafeHandleNative.cpp -) -add_library (SafeHandleNative SHARED ${SOURCES}) -target_link_libraries(SafeHandleNative ${LINK_LIBRARIES_ADDITIONAL}) -install (TARGETS SafeHandleNative DESTINATION bin) + +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + SafeHandleNative.cpp +) +add_library (SafeHandleNative SHARED ${SOURCES}) +target_link_libraries(SafeHandleNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +install (TARGETS SafeHandleNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/SetLastError/CMakeLists.txt b/src/tests/Interop/PInvoke/SetLastError/CMakeLists.txt index 4a0cae2e12ca0e..6cc6928999aff5 100644 --- a/src/tests/Interop/PInvoke/SetLastError/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/SetLastError/CMakeLists.txt @@ -1,10 +1,10 @@ project(SetLastErrorNative) -include("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES SetLastErrorNative.cpp) # add the shared library add_library(SetLastErrorNative SHARED ${SOURCES}) -target_link_libraries(SetLastErrorNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(SetLastErrorNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install(TARGETS SetLastErrorNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByOut/CMakeLists.txt b/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByOut/CMakeLists.txt index 89c6ee61d46532..2bbda0182f716d 100644 --- a/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByOut/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByOut/CMakeLists.txt @@ -1,11 +1,11 @@ -project (PInvokePassingByOutNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -include_directories("..") -set(SOURCES - PInvokePassingByOutNative.cpp +project (PInvokePassingByOutNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include_directories("..") +set(SOURCES + PInvokePassingByOutNative.cpp ) -# add the executable -add_library (PInvokePassingByOutNative SHARED ${SOURCES}) -target_link_libraries(PInvokePassingByOutNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS PInvokePassingByOutNative DESTINATION bin) +# add the executable +add_library (PInvokePassingByOutNative SHARED ${SOURCES}) +target_link_libraries(PInvokePassingByOutNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS PInvokePassingByOutNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByRef/CMakeLists.txt b/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByRef/CMakeLists.txt index e0daa377b3e08d..bf9d8c9c288550 100644 --- a/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByRef/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByRef/CMakeLists.txt @@ -1,11 +1,11 @@ -project (PInvokePassingByRefNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -include_directories("..") -set(SOURCES - PInvokePassingByRefNative.cpp -) -# add the executable -add_library (PInvokePassingByRefNative SHARED ${SOURCES}) -target_link_libraries(PInvokePassingByRefNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS PInvokePassingByRefNative DESTINATION bin) +project (PInvokePassingByRefNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include_directories("..") +set(SOURCES + PInvokePassingByRefNative.cpp +) +# add the executable +add_library (PInvokePassingByRefNative SHARED ${SOURCES}) +target_link_libraries(PInvokePassingByRefNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS PInvokePassingByRefNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByOut/CMakeLists.txt b/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByOut/CMakeLists.txt index a2871bbf92309f..65df81bce9f71d 100644 --- a/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByOut/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByOut/CMakeLists.txt @@ -1,13 +1,13 @@ -project (RPIP_ByOutNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -include_directories("..") -set(SOURCES - ReversePInvokePassingByOutNative.cpp -) -# Additional files to reference: -# add the executable -add_library (RPIP_ByOutNative SHARED ${SOURCES}) +project (RPIP_ByOutNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include_directories("..") +set(SOURCES + ReversePInvokePassingByOutNative.cpp +) +# Additional files to reference: +# add the executable +add_library (RPIP_ByOutNative SHARED ${SOURCES}) set_property (TARGET RPIP_ByOutNative PROPERTY OUTPUT_NAME ReversePInvokePassingByOutNative) -target_link_libraries(RPIP_ByOutNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS RPIP_ByOutNative DESTINATION bin) +target_link_libraries(RPIP_ByOutNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS RPIP_ByOutNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByRef/CMakeLists.txt b/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByRef/CMakeLists.txt index 172be23050eab6..bfac0325b011a9 100644 --- a/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByRef/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByRef/CMakeLists.txt @@ -1,13 +1,13 @@ project (RPIP_ByRefNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -include_directories("..") -set(SOURCES - ReversePInvokePassingByRefNative.cpp -) -# Additional files to reference: -# add the executable -add_library (RPIP_ByRefNative SHARED ${SOURCES}) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include_directories("..") +set(SOURCES + ReversePInvokePassingByRefNative.cpp +) +# Additional files to reference: +# add the executable +add_library (RPIP_ByRefNative SHARED ${SOURCES}) set_property (TARGET RPIP_ByRefNative PROPERTY OUTPUT_NAME ReversePInvokePassingByRefNative) -target_link_libraries(RPIP_ByRefNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS RPIP_ByRefNative DESTINATION bin) +target_link_libraries(RPIP_ByRefNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS RPIP_ByRefNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Varargs/CMakeLists.txt b/src/tests/Interop/PInvoke/Varargs/CMakeLists.txt index 010dcc40ec6521..b4f45d0f342fd7 100644 --- a/src/tests/Interop/PInvoke/Varargs/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Varargs/CMakeLists.txt @@ -1,10 +1,10 @@ project (VarargsNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES VarargsNative.cpp ) # add the executable add_library (VarargsNative SHARED ${SOURCES}) -target_link_libraries(VarargsNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(VarargsNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS VarargsNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Variant/CMakeLists.txt b/src/tests/Interop/PInvoke/Variant/CMakeLists.txt index 69752ad4e8ddf5..2cfedc6573bef1 100644 --- a/src/tests/Interop/PInvoke/Variant/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Variant/CMakeLists.txt @@ -11,7 +11,7 @@ if(CLR_CMAKE_HOST_WIN32) ) endif(CLR_CMAKE_HOST_WIN32) -target_link_libraries(VariantNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(VariantNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS VariantNative DESTINATION bin) diff --git a/src/tests/Interop/PInvoke/Vector2_3_4/CMakeLists.txt b/src/tests/Interop/PInvoke/Vector2_3_4/CMakeLists.txt index ae38c05536d682..285855cf24ca8d 100644 --- a/src/tests/Interop/PInvoke/Vector2_3_4/CMakeLists.txt +++ b/src/tests/Interop/PInvoke/Vector2_3_4/CMakeLists.txt @@ -1,8 +1,8 @@ - -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - Vector2_3_4TestNative.cpp + +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + Vector2_3_4TestNative.cpp ) -add_library (Vector2_3_4TestNative SHARED ${SOURCES}) -target_link_libraries(Vector2_3_4TestNative ${LINK_LIBRARIES_ADDITIONAL}) -install (TARGETS Vector2_3_4TestNative DESTINATION bin) +add_library (Vector2_3_4TestNative SHARED ${SOURCES}) +target_link_libraries(Vector2_3_4TestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +install (TARGETS Vector2_3_4TestNative DESTINATION bin) diff --git a/src/tests/Interop/PrimitiveMarshalling/Bool/CMakeLists.txt b/src/tests/Interop/PrimitiveMarshalling/Bool/CMakeLists.txt index efafb84e4a27e6..9e3d9515f5d54e 100644 --- a/src/tests/Interop/PrimitiveMarshalling/Bool/CMakeLists.txt +++ b/src/tests/Interop/PrimitiveMarshalling/Bool/CMakeLists.txt @@ -1,16 +1,16 @@ project (NativeBool) set(SOURCES BoolNative.cpp ) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (BoolNative SHARED ${SOURCES}) -target_link_libraries(BoolNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(BoolNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) #get_cmake_property(_variableNames VARIABLES) #foreach (_variableName ${_variableNames}) # message(STATUS "${_variableName}=${${_variableName}}") #endforeach() - + #SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) diff --git a/src/tests/Interop/PrimitiveMarshalling/EnumMarshalling/CMakeLists.txt b/src/tests/Interop/PrimitiveMarshalling/EnumMarshalling/CMakeLists.txt index 70b8d31b91d22b..a90046bcc99544 100644 --- a/src/tests/Interop/PrimitiveMarshalling/EnumMarshalling/CMakeLists.txt +++ b/src/tests/Interop/PrimitiveMarshalling/EnumMarshalling/CMakeLists.txt @@ -4,7 +4,7 @@ include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (MarshalEnumNative SHARED ${SOURCES}) -target_link_libraries(MarshalEnumNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(MarshalEnumNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS MarshalEnumNative DESTINATION bin) diff --git a/src/tests/Interop/PrimitiveMarshalling/UIntPtr/CMakeLists.txt b/src/tests/Interop/PrimitiveMarshalling/UIntPtr/CMakeLists.txt index b8d4314ae90efa..1d38872d792cdc 100644 --- a/src/tests/Interop/PrimitiveMarshalling/UIntPtr/CMakeLists.txt +++ b/src/tests/Interop/PrimitiveMarshalling/UIntPtr/CMakeLists.txt @@ -1,10 +1,10 @@ project (UIntPtrNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES UIntPtrNative.cpp ) # add the executable add_library (UIntPtrNative SHARED ${SOURCES}) -target_link_libraries(UIntPtrNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(UIntPtrNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets -install (TARGETS UIntPtrNative DESTINATION bin) \ No newline at end of file +install (TARGETS UIntPtrNative DESTINATION bin) diff --git a/src/tests/Interop/RefCharArray/CMakeLists.txt b/src/tests/Interop/RefCharArray/CMakeLists.txt index 3e2a7756e79bf0..aa6105e15a07a1 100644 --- a/src/tests/Interop/RefCharArray/CMakeLists.txt +++ b/src/tests/Interop/RefCharArray/CMakeLists.txt @@ -4,7 +4,7 @@ include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (RefCharArrayNative SHARED ${SOURCES}) -target_link_libraries(RefCharArrayNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(RefCharArrayNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS RefCharArrayNative DESTINATION bin) diff --git a/src/tests/Interop/SimpleStruct/CMakeLists.txt b/src/tests/Interop/SimpleStruct/CMakeLists.txt index 6d5f14a52726b9..b3d50930d867e5 100644 --- a/src/tests/Interop/SimpleStruct/CMakeLists.txt +++ b/src/tests/Interop/SimpleStruct/CMakeLists.txt @@ -1,10 +1,10 @@ project (SimpleStructNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES SimpleStructNative.cpp ) # add the executable add_library (SimpleStructNative SHARED ${SOURCES}) -target_link_libraries(SimpleStructNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(SimpleStructNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets -install (TARGETS SimpleStructNative DESTINATION bin) \ No newline at end of file +install (TARGETS SimpleStructNative DESTINATION bin) diff --git a/src/tests/Interop/StringMarshalling/AnsiBSTR/CMakeLists.txt b/src/tests/Interop/StringMarshalling/AnsiBSTR/CMakeLists.txt index 6a92f9a5a27511..2e8b2fb2270f04 100644 --- a/src/tests/Interop/StringMarshalling/AnsiBSTR/CMakeLists.txt +++ b/src/tests/Interop/StringMarshalling/AnsiBSTR/CMakeLists.txt @@ -11,7 +11,7 @@ if(CLR_CMAKE_HOST_WIN32) ) endif(CLR_CMAKE_HOST_WIN32) -target_link_libraries(AnsiBStrTestNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(AnsiBStrTestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS AnsiBStrTestNative DESTINATION bin) diff --git a/src/tests/Interop/StringMarshalling/BSTR/CMakeLists.txt b/src/tests/Interop/StringMarshalling/BSTR/CMakeLists.txt index b36300acc5943d..226f128f400bbb 100644 --- a/src/tests/Interop/StringMarshalling/BSTR/CMakeLists.txt +++ b/src/tests/Interop/StringMarshalling/BSTR/CMakeLists.txt @@ -10,7 +10,7 @@ if(CLR_CMAKE_HOST_WIN32) ) endif(CLR_CMAKE_HOST_WIN32) -target_link_libraries(BStrTestNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(BStrTestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS BStrTestNative DESTINATION bin) diff --git a/src/tests/Interop/StringMarshalling/LPSTR/CMakeLists.txt b/src/tests/Interop/StringMarshalling/LPSTR/CMakeLists.txt index 88ec002ec5edf2..6f5e933def9d5f 100644 --- a/src/tests/Interop/StringMarshalling/LPSTR/CMakeLists.txt +++ b/src/tests/Interop/StringMarshalling/LPSTR/CMakeLists.txt @@ -3,7 +3,7 @@ include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (LPStrTestNative SHARED ${SOURCES}) -target_link_libraries(LPStrTestNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(LPStrTestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS LPStrTestNative DESTINATION bin) diff --git a/src/tests/Interop/StringMarshalling/LPTSTR/CMakeLists.txt b/src/tests/Interop/StringMarshalling/LPTSTR/CMakeLists.txt index 1bddeac704a8ac..a3c838faf4565d 100644 --- a/src/tests/Interop/StringMarshalling/LPTSTR/CMakeLists.txt +++ b/src/tests/Interop/StringMarshalling/LPTSTR/CMakeLists.txt @@ -3,7 +3,7 @@ include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (LPTStrTestNative SHARED ${SOURCES}) -target_link_libraries(LPTStrTestNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(LPTStrTestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS LPTStrTestNative DESTINATION bin) diff --git a/src/tests/Interop/StringMarshalling/UTF8/CMakeLists.txt b/src/tests/Interop/StringMarshalling/UTF8/CMakeLists.txt index 83011495be0d04..dd50b710457224 100644 --- a/src/tests/Interop/StringMarshalling/UTF8/CMakeLists.txt +++ b/src/tests/Interop/StringMarshalling/UTF8/CMakeLists.txt @@ -4,7 +4,7 @@ include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") # add the executable add_library (UTF8TestNative SHARED ${SOURCES}) -target_link_libraries(UTF8TestNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(UTF8TestNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS UTF8TestNative DESTINATION bin) diff --git a/src/tests/Interop/StringMarshalling/VBByRefStr/CMakeLists.txt b/src/tests/Interop/StringMarshalling/VBByRefStr/CMakeLists.txt index 6096d773566b17..79039283d55f57 100644 --- a/src/tests/Interop/StringMarshalling/VBByRefStr/CMakeLists.txt +++ b/src/tests/Interop/StringMarshalling/VBByRefStr/CMakeLists.txt @@ -1,10 +1,10 @@ project (VBByRefStrNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES VBByRefStrNative.cpp ) # add the executable add_library (VBByRefStrNative SHARED ${SOURCES}) -target_link_libraries(VBByRefStrNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(VBByRefStrNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS VBByRefStrNative DESTINATION bin) diff --git a/src/tests/Interop/StructMarshalling/PInvoke/CMakeLists.txt b/src/tests/Interop/StructMarshalling/PInvoke/CMakeLists.txt index 9941369defd260..199e1d9440df8e 100644 --- a/src/tests/Interop/StructMarshalling/PInvoke/CMakeLists.txt +++ b/src/tests/Interop/StructMarshalling/PInvoke/CMakeLists.txt @@ -1,10 +1,10 @@ project (MarshalStructAsParam) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES MarshalStructAsParamDLL.cpp) # add the executable add_library (MarshalStructAsParam SHARED ${SOURCES}) -target_link_libraries(MarshalStructAsParam ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(MarshalStructAsParam PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets -install (TARGETS MarshalStructAsParam DESTINATION bin) \ No newline at end of file +install (TARGETS MarshalStructAsParam DESTINATION bin) diff --git a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/CMakeLists.txt b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/CMakeLists.txt index c2a31950a70be8..b27d067e33a8ae 100644 --- a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/CMakeLists.txt +++ b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/CMakeLists.txt @@ -1,11 +1,11 @@ -project (ReversePInvokeNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - ExpStructAsParamNative.cpp -) -# add the executable +project (ReversePInvokeNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + ExpStructAsParamNative.cpp +) +# add the executable add_library (ReversePInvokeNative SHARED ${SOURCES}) -target_link_libraries(ReversePInvokeNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS ReversePInvokeNative DESTINATION bin) +target_link_libraries(ReversePInvokeNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS ReversePInvokeNative DESTINATION bin) diff --git a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/CMakeLists.txt b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/CMakeLists.txt index ef11ce1acb6521..8a9f9c23f99a38 100644 --- a/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/CMakeLists.txt +++ b/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/CMakeLists.txt @@ -1,9 +1,9 @@ -project (SeqPInvokeNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - SeqStructDelRevPInvokeNative.cpp -) -add_library (SeqPInvokeNative SHARED ${SOURCES}) -target_link_libraries(SeqPInvokeNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS SeqPInvokeNative DESTINATION bin) +project (SeqPInvokeNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + SeqStructDelRevPInvokeNative.cpp +) +add_library (SeqPInvokeNative SHARED ${SOURCES}) +target_link_libraries(SeqPInvokeNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS SeqPInvokeNative DESTINATION bin) diff --git a/src/tests/Interop/SuppressGCTransition/CMakeLists.txt b/src/tests/Interop/SuppressGCTransition/CMakeLists.txt index 08892034d0365b..663b8e5d440113 100644 --- a/src/tests/Interop/SuppressGCTransition/CMakeLists.txt +++ b/src/tests/Interop/SuppressGCTransition/CMakeLists.txt @@ -1,9 +1,9 @@ -project (SuppressGCTransitionNative) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") -set(SOURCES - SuppressGCTransitionNative.cpp -) -add_library (SuppressGCTransitionNative SHARED ${SOURCES}) -target_link_libraries(SuppressGCTransitionNative ${LINK_LIBRARIES_ADDITIONAL}) -# add the install targets -install (TARGETS SuppressGCTransitionNative DESTINATION bin) +project (SuppressGCTransitionNative) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +set(SOURCES + SuppressGCTransitionNative.cpp +) +add_library (SuppressGCTransitionNative SHARED ${SOURCES}) +target_link_libraries(SuppressGCTransitionNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) +# add the install targets +install (TARGETS SuppressGCTransitionNative DESTINATION bin) diff --git a/src/tests/Interop/UnmanagedCallersOnly/CMakeLists.txt b/src/tests/Interop/UnmanagedCallersOnly/CMakeLists.txt index b693f57275f971..37e5fa5e669839 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/CMakeLists.txt +++ b/src/tests/Interop/UnmanagedCallersOnly/CMakeLists.txt @@ -1,10 +1,10 @@ project (UnmanagedCallersOnlyDll) -include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(SOURCES UnmanagedCallersOnlyDll.cpp ) # add the executable add_library (UnmanagedCallersOnlyDll SHARED ${SOURCES}) -target_link_libraries(UnmanagedCallersOnlyDll ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(UnmanagedCallersOnlyDll PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS UnmanagedCallersOnlyDll DESTINATION bin) diff --git a/src/tests/nativeaot/SmokeTests/PInvoke/CMakeLists.txt b/src/tests/nativeaot/SmokeTests/PInvoke/CMakeLists.txt index 59a9bc06209122..7aabb442144009 100644 --- a/src/tests/nativeaot/SmokeTests/PInvoke/CMakeLists.txt +++ b/src/tests/nativeaot/SmokeTests/PInvoke/CMakeLists.txt @@ -8,7 +8,7 @@ if(CLR_CMAKE_HOST_WIN32) endif(CLR_CMAKE_HOST_WIN32) add_library (PInvokeNative SHARED PInvokeNative.cpp) -target_link_libraries(PInvokeNative ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(PInvokeNative PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS PInvokeNative DESTINATION bin) diff --git a/src/tests/nativeaot/SmokeTests/SharedLibrary/CMakeLists.txt b/src/tests/nativeaot/SmokeTests/SharedLibrary/CMakeLists.txt index f0cc69d9a46408..5af70a164ba562 100644 --- a/src/tests/nativeaot/SmokeTests/SharedLibrary/CMakeLists.txt +++ b/src/tests/nativeaot/SmokeTests/SharedLibrary/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories(${INC_PLATFORM_DIR}) add_executable (SharedLibraryDriver SharedLibrary.cpp) if (CLR_CMAKE_TARGET_UNIX) - target_link_libraries (SharedLibraryDriver ${CMAKE_DL_LIBS}) + target_link_libraries (SharedLibraryDriver PRIVATE ${CMAKE_DL_LIBS}) endif() # add the install targets From ded24c813bb1e900d247b1a84f3ce754abbe1b9f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 10 Feb 2023 11:47:20 -0800 Subject: [PATCH 2/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aleksey Kliger (λgeek) --- src/mono/mono/component/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/component/CMakeLists.txt b/src/mono/mono/component/CMakeLists.txt index acb2a2b6b8b769..c17df717441627 100644 --- a/src/mono/mono/component/CMakeLists.txt +++ b/src/mono/mono/component/CMakeLists.txt @@ -149,13 +149,13 @@ endif() foreach(component IN LISTS components) if(NOT DISABLE_COMPONENT_OBJECTS) add_library("${component}-objects" OBJECT "${${component}-sources}") - target_link_libraries("${component}-objects" PUBLIC component_base) + target_link_libraries("${component}-objects" PRIVATE component_base) foreach(dependency IN LISTS "${component}-dependencies") add_dependencies("${component}-objects" "${dependency}") endforeach() endif() add_library("${component}-stub-objects" OBJECT "${${component}-stub-sources}") - target_link_libraries("${component}-stub-objects" PUBLIC component_base) + target_link_libraries("${component}-stub-objects" PRIVATE component_base) endforeach() if(NOT DISABLE_COMPONENTS AND NOT STATIC_COMPONENTS) From 8241682459846e33e61bd4eacd9a9db1d31475d5 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 22 Feb 2023 10:40:14 -0800 Subject: [PATCH 3/4] PR feedback. --- src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt | 2 +- src/native/libs/build-native.cmd | 1 - src/tests/Interop/UnmanagedCallConv/CMakeLists.txt | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt index d2562ef8e32dc7..4b7337f6e70085 100644 --- a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -63,7 +63,7 @@ add_dependencies(coreclrtraceptprovider generated_eventing_headers) find_library(LTTNG NAMES lttng-ust) target_link_libraries(coreclrtraceptprovider - PUBLIC + PRIVATE ${LTTNG} ) diff --git a/src/native/libs/build-native.cmd b/src/native/libs/build-native.cmd index aadcb949ec102d..af8a4178675f5b 100644 --- a/src/native/libs/build-native.cmd +++ b/src/native/libs/build-native.cmd @@ -17,7 +17,6 @@ set __BuildArch=x64 set __BuildTarget="build" set __TargetOS=windows set CMAKE_BUILD_TYPE=Debug -set "__LinkLibraries= " set __Ninja=1 :Arg_Loop diff --git a/src/tests/Interop/UnmanagedCallConv/CMakeLists.txt b/src/tests/Interop/UnmanagedCallConv/CMakeLists.txt index 4e8d8692a07ba3..93a124bb5a54e0 100644 --- a/src/tests/Interop/UnmanagedCallConv/CMakeLists.txt +++ b/src/tests/Interop/UnmanagedCallConv/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES UnmanagedCallConvNative.cpp ) # add the executable add_library(${PROJECT_NAME} SHARED ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES_ADDITIONAL}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${LINK_LIBRARIES_ADDITIONAL}) # add the install targets install (TARGETS ${PROJECT_NAME} DESTINATION bin) From 1cb88cfef9d10e3dbf5946ade9ed7e0604ef6769 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 24 Feb 2023 10:35:07 -0800 Subject: [PATCH 4/4] Update AppBuilder templates --- src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt | 1 + src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template | 1 + 2 files changed, 2 insertions(+) diff --git a/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt b/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt index b3032a9e5557ed..0c3eedab918e6e 100644 --- a/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt +++ b/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt @@ -23,6 +23,7 @@ include_directories("%MonoInclude%") target_link_libraries( monodroid + PRIVATE %NativeLibrariesToLink% libz.so log diff --git a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template index aba07978fb990a..dc24a60ff4523a 100644 --- a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template +++ b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template @@ -66,6 +66,7 @@ endif() target_link_libraries( %ProjectName% + PRIVATE "-framework Foundation" "-framework Security" "-framework UIKit"