[CMAKE] Use new policies for CMP0005 and CMP0018 (#1481)
authorAndrew Cook <ariscop@gmail.com>
Sat, 27 Apr 2019 09:33:37 +0000 (19:33 +1000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 27 Apr 2019 09:33:37 +0000 (11:33 +0200)
* [CMAKE] Fix for CMP0018
The new behaviour lets us explicitly disabling position independent code, avoiding the need to change undocumented variables

* LINK_DEPENDS is semicolon separated

* [CMAKE] Fix for CMP0005
it seems impossible to have cmake correct escape PROXY_CLSID_IS so move it to the header

CMakeLists.txt
dll/win32/urlmon/CMakeLists.txt
dll/win32/urlmon/urlmon_main.h
sdk/cmake/compilerflags.cmake
sdk/cmake/gcc.cmake

index 3b66140..48b3b18 100644 (file)
@@ -6,12 +6,6 @@ if(NOT CMAKE_VERSION MATCHES "ReactOS")
     message(WARNING "Building with \"${CMAKE_COMMAND}\", which is not the custom CMake included in RosBE, might cause build issues...")
 endif()
 
-# Don't escape preprocessor definition values added via add_definitions
-cmake_policy(SET CMP0005 OLD)
-
-# Honor CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
-cmake_policy(SET CMP0018 OLD)
-
 if(POLICY CMP0058)
     # Ninja requires custom command byproducts to be explicit
     cmake_policy(SET CMP0058 OLD)
@@ -34,6 +28,7 @@ set(CMAKE_SHARED_MODULE_PREFIX "")
 set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
 set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
 set(CMAKE_COLOR_MAKEFILE OFF)
+set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
 #set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
 
 if(NOT DEFINED NEW_STYLE_BUILD)
@@ -65,8 +60,8 @@ include(sdk/cmake/compilerflags.cmake)
 add_definitions(-D__REACTOS__)
 
 # Double escape, since CMake unescapes before putting it on the command-line, where it's unescaped again by GCC/CL.
-add_definitions(-DREACTOS_SOURCE_DIR="\\\"${REACTOS_SOURCE_DIR}\\\"")
-add_definitions(-DREACTOS_BINARY_DIR="\\\"${REACTOS_BINARY_DIR}\\\"")
+add_definitions(-DREACTOS_SOURCE_DIR="${REACTOS_SOURCE_DIR}")
+add_definitions(-DREACTOS_BINARY_DIR="${REACTOS_BINARY_DIR}")
 
 # There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
 file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR})
index 6c7938f..ef9c537 100644 (file)
@@ -4,8 +4,7 @@ add_definitions(
     -D_URLMON_
     -DENTRY_PREFIX=URLMON_
     -DPROXY_DELEGATION
-    -DWINE_REGISTER_DLL
-    -DPROXY_CLSID_IS="{0x79EAC9F1,0xBAF9,0x11CE,{0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B}}")
+    -DWINE_REGISTER_DLL)
 
 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
 spec2def(urlmon.dll urlmon.spec ADD_IMPORTLIB)
index 39dbe2f..e28b351 100644 (file)
 
 #define COBJMACROS
 
+#ifdef __REACTOS__
+#define PROXY_CLSID_IS {0x79EAC9F1,0xBAF9,0x11CE,{0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B}}
+#endif
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
index 3928b79..669a4ff 100644 (file)
@@ -5,7 +5,7 @@
 #  while others require space-separated strings. The function has a list of
 #  properties of the former variety and handles the values accordingly
 function(add_target_property _module _propname)
-    list(APPEND _list_properties COMPILE_DEFINITIONS INCLUDE_DIRECTORIES)
+    list(APPEND _list_properties COMPILE_DEFINITIONS INCLUDE_DIRECTORIES LINK_DEPENDS)
     set(_newvalue "")
     get_target_property(_oldvalue ${_module} ${_propname})
     if(_oldvalue)
index 8ecc06b..220e868 100644 (file)
@@ -61,10 +61,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
     set(CMAKE_CXX_COMPILE_OPTIONS_PIC "")
     set(CMAKE_C_COMPILE_OPTIONS_PIE "")
     set(CMAKE_CXX_COMPILE_OPTIONS_PIE "")
-    set(CMAKE_SHARED_LIBRARY_C_FLAGS "")
-    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
-    set(CMAKE_SHARED_MODULE_C_FLAGS "")
-    set(CMAKE_SHARED_MODULE_CXX_FLAGS "")
     set(CMAKE_ASM_FLAGS_DEBUG "")
     set(CMAKE_C_FLAGS_DEBUG "")
     set(CMAKE_CXX_FLAGS_DEBUG "")
@@ -103,14 +99,6 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
     endif()
 endif()
 
-# For some reason, cmake sets -fPIC, and we don't want it
-if(DEFINED CMAKE_SHARED_LIBRARY_ASM_FLAGS)
-    string(REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_ASM_FLAGS ${CMAKE_SHARED_LIBRARY_ASM_FLAGS})
-endif()
-if(DEFINED CMAKE_SHARED_MODULE_ASM_FLAGS)
-    string(REPLACE "-fPIC" "" CMAKE_SHARED_MODULE_ASM_FLAGS ${CMAKE_SHARED_MODULE_ASM_FLAGS})
-endif()
-
 # Tuning
 if(ARCH STREQUAL "i386")
     add_compile_flags("-march=${OARCH} -mtune=${TUNE}")