[CMAKE] Use new policies for CMP0005 and CMP0018 (#1481)

* [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
This commit is contained in:
Andrew Cook 2019-04-27 19:33:37 +10:00 committed by Timo Kreuzer
parent 3af58ea993
commit 716613cddc
5 changed files with 9 additions and 23 deletions

View 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})

View 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)

View file

@ -24,6 +24,10 @@
#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"

View 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)

View 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}")