[NETCFGX] Move the NetClassInstaller to a separate file.
[reactos.git] / CMakeLists.txt
index f4c38c8..d2e8b86 100644 (file)
@@ -1,20 +1,16 @@
 
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.2.1)
+cmake_policy(VERSION 3.2.1)
 
-if(POLICY CMP0017)
-    # Shadow cmake provided modules
-    cmake_policy(SET CMP0017 OLD)
+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()
 
-if(POLICY CMP0026)
-    # Allow use of the LOCATION property
-    cmake_policy(SET CMP0026 OLD)
-endif()
+# Don't escape preprocessor definition values added via add_definitions
+cmake_policy(SET CMP0005 OLD)
 
-if(POLICY CMP0051)
-    # List TARGET_OBJECTS in SOURCES target property
-    cmake_policy(SET CMP0051 NEW)
-endif()
+# Honor CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
+cmake_policy(SET CMP0018 OLD)
 
 if(POLICY CMP0058)
     # Ninja requires custom command byproducts to be explicit
@@ -26,13 +22,6 @@ project(REACTOS)
 # Versioning
 include(sdk/include/reactos/version.cmake)
 
-# Don't escape preprocessor definition values added via add_definitions
-cmake_policy(SET CMP0005 OLD)
-cmake_policy(SET CMP0002 NEW)
-if(POLICY CMP0018)
-    cmake_policy(SET CMP0018 OLD)
-endif()
-
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
 set(CMAKE_SHARED_LIBRARY_PREFIX "")
@@ -68,17 +57,14 @@ endif()
 include(sdk/cmake/compilerflags.cmake)
 
 add_definitions(-D__REACTOS__)
+add_definitions(-DREACTOS_SOURCE_DIR="\\"${REACTOS_SOURCE_DIR}\\"")
+add_definitions(-DREACTOS_BINARY_DIR="\\"${REACTOS_BINARY_DIR}\\"")
+add_compile_flags(-D__RELFILE__="&__FILE__[sizeof REACTOS_SOURCE_DIR]")
 
 if(MSVC_IDE)
     add_compile_flags("/MP")
 endif()
 
-# We don't need CMake importlib handling.
-# FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands.
-if(NOT MSVC_IDE)
-    unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
-endif()
-
 # Bison and Flex support
 # include(sdk/cmake/bison-flex.cmake)
 
@@ -97,7 +83,10 @@ if(NOT CMAKE_CROSSCOMPILING)
         if(MSVC_VERSION GREATER 1699)
             add_definitions(/D_ALLOW_KEYWORD_MACROS)
         endif()
-        add_definitions(/Dinline=__inline)
+        if(NOT USE_CLANG_CL)
+            # FIXME: Inspect
+            add_definitions(/Dinline=__inline)
+        endif()
     endif()
 
     include_directories(sdk/include/host)
@@ -117,6 +106,8 @@ if(NOT CMAKE_CROSSCOMPILING)
     endif()
 
 else()
+    # We don't need CMake importlib handling.
+    unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
 
     if(NEW_STYLE_BUILD)
         include(sdk/cmake/host-tools.cmake)
@@ -135,16 +126,6 @@ else()
     #useful stuff!
     include(CMakeParseArguments)
 
-    # Do some cleanup
-    file(REMOVE
-        ${REACTOS_BINARY_DIR}/dependencies.graphml
-        ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
-        ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt
-        ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt
-        ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt
-        ${REACTOS_BINARY_DIR}/boot/ros_cab.txt
-        ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
-
     if(NOT NEW_STYLE_BUILD)
         if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
             set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
@@ -182,7 +163,10 @@ else()
 
     # Arch Options
     if(ARCH STREQUAL "i386")
-        add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
+        if(NOT USE_CLANG_CL)
+            add_definitions(-D_M_IX86)
+        endif()
+        add_definitions(-D_X86_ -D__i386__ -Di386)
     elseif(ARCH STREQUAL "amd64")
         add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
     elseif(ARCH STREQUAL "arm")