[CMAKE] unset EXPORT_SYMBOL for modules and shared libraries
authorJérôme Gardou <jerome.gardou@reactos.org>
Sat, 6 Apr 2019 11:22:50 +0000 (13:22 +0200)
committerJérôme Gardou <zefklop@users.noreply.github.com>
Sat, 6 Apr 2019 15:43:38 +0000 (17:43 +0200)
We don't use that

ntoskrnl/CMakeLists.txt
sdk/cmake/CMakeMacros.cmake

index d1ee382..3111893 100644 (file)
@@ -19,6 +19,7 @@ add_executable(ntoskrnl
     ntoskrnl.rc
     ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
 set_property(TARGET ntoskrnl PROPERTY ENABLE_EXPORTS TRUE)
+set_target_properties(ntoskrnl PROPERTIES DEFINE_SYMBOL "")
 
 if(ARCH STREQUAL "i386")
     set_entrypoint(ntoskrnl KiSystemStartup 4)
index 70d146d..b8fe5ad 100644 (file)
@@ -524,6 +524,11 @@ if(NOT MSVC_IDE)
     function(add_library name)
         _add_library(${name} ${ARGN})
         add_clean_target(${name})
+        # cmake adds a module_EXPORTS define when compiling a module or a shared library. We don't use that.
+        get_target_property(_type ${name} TYPE)
+        if (_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
+            set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "")
+        endif()
     endfunction()
 
     function(add_executable name)
@@ -549,6 +554,11 @@ elseif(USE_FOLDER_STRUCTURE)
             string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1 CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
             set_property(TARGET "${name}" PROPERTY FOLDER "${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
         endif()
+        # cmake adds a module_EXPORTS define when compiling a module or a shared library. We don't use that.
+        get_target_property(_type ${name} TYPE)
+        if (_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
+            set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "")
+        endif()
     endfunction()
 
     function(add_executable name)
@@ -556,6 +566,15 @@ elseif(USE_FOLDER_STRUCTURE)
         string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1 CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
         set_property(TARGET "${name}" PROPERTY FOLDER "${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
     endfunction()
+else()
+    function(add_library name)
+        _add_library(${name} ${ARGN})
+        # cmake adds a module_EXPORTS define when compiling a module or a shared library. We don't use that.
+        get_target_property(_type ${name} TYPE)
+        if (_type MATCHES SHARED_LIBRARY|MODULE_LIBRARY)
+            set_target_properties(${name} PROPERTIES DEFINE_SYMBOL "")
+        endif()
+    endfunction()
 endif()
 
 if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")