https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6ea8659c87cbbb60a6ba…
commit d6ea8659c87cbbb60a6ba3760c14f6d5aaf0fbba
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Fri Sep 18 09:34:18 2020 +0200
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Tue Oct 20 21:44:54 2020 +0200
[CMAKE] Get rid of the set_cpp macro
Instead of messing with global variables and the like, we introduce two target
properties:
- WITH_CXX_EXCEPTIONS: if you want to use C++ exceptions
- WITH_CXX_RTTI: if you need RTTI in your module
You can use the newly introduced set_target_cpp_properties function, with
WITH_EXCEPTIONS and WITH_RTTI arguments
We also introduce two libraries :
- cpprt: for C++ runtime routines
- cppstl: for the C++ standard template library
NB: On GCC, this requires to create imported libraries with the related built-in
libraries:libsupc++, limingwex, libstdc++
Finally, we manage the relevant flags with the ad-hoc generator expressions
So, if you don't need exceptions, nor RTTI, nor use any runtime at all: you simply
have nothing else to do than add your C++ file to your module
---
CMakeLists.txt | 14 ++++
base/applications/atactl/CMakeLists.txt | 1 -
base/applications/charmap_new/CMakeLists.txt | 7 +-
base/applications/drwtsn32/CMakeLists.txt | 4 +-
base/applications/fltmc/CMakeLists.txt | 4 +-
base/applications/games/solitaire/CMakeLists.txt | 3 -
base/applications/games/spider/CMakeLists.txt | 7 +-
base/applications/msconfig_new/CMakeLists.txt | 5 +-
base/applications/mspaint/CMakeLists.txt | 4 +-
base/applications/network/telnet/CMakeLists.txt | 4 +-
base/applications/rapps/CMakeLists.txt | 4 +-
base/applications/sndrec32/CMakeLists.txt | 3 +-
base/shell/explorer/CMakeLists.txt | 3 +-
base/shell/rshell/CMakeLists.txt | 17 ++--
dll/directx/ksproxy/CMakeLists.txt | 3 +-
dll/opengl/glu32/CMakeLists.txt | 3 +-
dll/shellext/acppage/CMakeLists.txt | 3 +-
dll/shellext/fontext/CMakeLists.txt | 3 +-
dll/shellext/mydocs/CMakeLists.txt | 3 +-
dll/shellext/netshell/CMakeLists.txt | 3 +-
dll/shellext/ntobjshex/CMakeLists.txt | 3 +-
dll/shellext/sendmail/CMakeLists.txt | 3 +-
dll/shellext/shellbtrfs/CMakeLists.txt | 4 +-
dll/shellext/stobject/CMakeLists.txt | 4 +-
dll/shellext/zipfldr/CMakeLists.txt | 4 +-
dll/win32/browseui/CMakeLists.txt | 10 +--
dll/win32/browseui/shellbars/CMakeLists.txt | 2 -
dll/win32/browseui/shellfind/CMakeLists.txt | 2 -
dll/win32/devmgr/CMakeLists.txt | 7 +-
dll/win32/framedyn/CMakeLists.txt | 3 +-
dll/win32/msgina/CMakeLists.txt | 3 +-
dll/win32/shell32/CMakeLists.txt | 3 +-
dll/win32/shell32/shelldesktop/CMakeLists.txt | 2 -
dll/win32/shell32/shellmenu/CMakeLists.txt | 2 -
dll/win32/shlwapi/CMakeLists.txt | 1 -
drivers/filesystems/udfs/CMakeLists.txt | 2 -
drivers/storage/ide/uniata/CMakeLists.txt | 1 -
drivers/usb/usbaudio/CMakeLists.txt | 1 -
drivers/wdm/audio/backpln/portcls/CMakeLists.txt | 1 -
drivers/wdm/audio/drivers/CMIDriver/CMakeLists.txt | 1 -
.../drivers/CMIDriver/cmicontrol/CMakeLists.txt | 1 -
.../wdm/audio/drivers/CMIDriver/cpl/CMakeLists.txt | 1 -
drivers/wdm/audio/hdaudbus/CMakeLists.txt | 1 -
.../applications/devutils/gdb2/CMakeLists.txt | 2 +-
.../applications/devutils/shlextdbg/CMakeLists.txt | 3 +-
.../applications/explorer-old/CMakeLists.txt | 5 +-
.../rosapps/applications/fraginator/CMakeLists.txt | 8 +-
.../rosapps/applications/net/netreg/CMakeLists.txt | 3 +-
.../applications/net/roshttpd/CMakeLists.txt | 3 +-
.../applications/sysutils/fontsub/CMakeLists.txt | 11 +--
.../applications/sysutils/regexpl/CMakeLists.txt | 4 +-
modules/rosapps/lib/vfdlib/CMakeLists.txt | 4 +-
modules/rostests/apitests/apphelp/CMakeLists.txt | 5 +-
modules/rostests/apitests/atl/CMakeLists.txt | 4 +-
modules/rostests/apitests/browseui/CMakeLists.txt | 7 +-
modules/rostests/apitests/fontext/CMakeLists.txt | 3 +-
modules/rostests/apitests/msgina/CMakeLists.txt | 3 +-
modules/rostests/apitests/ole32/CMakeLists.txt | 3 +-
modules/rostests/apitests/shell32/CMakeLists.txt | 5 +-
modules/rostests/apitests/zipfldr/CMakeLists.txt | 6 +-
modules/rostests/rosautotest/CMakeLists.txt | 4 +-
sdk/cmake/CMakeMacros.cmake | 94 +++-------------------
sdk/cmake/gcc.cmake | 62 ++++++++++----
sdk/cmake/msvc.cmake | 24 +++---
sdk/lib/3rdparty/cardlib/CMakeLists.txt | 5 +-
sdk/lib/3rdparty/stlport/CMakeLists.txt | 16 ++--
sdk/lib/comsupp/CMakeLists.txt | 4 +-
sdk/lib/cpprt/CMakeLists.txt | 3 +-
sdk/lib/drivers/sound/stdunk/CMakeLists.txt | 1 -
69 files changed, 193 insertions(+), 259 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce1995e3b80..cefcc5f93ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,6 +111,20 @@ else()
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+ # Add our own target properties
+ # C++
+ define_property(TARGET PROPERTY WITH_CXX_EXCEPTIONS
+ BRIEF_DOCS "Enable C++ exceptions on this target"
+ FULL_DOCS [[
+Enables C++ exception handling.
+Enable this if the module uses try/catch or throw. You might also need this if you use a
standard operator new (the one without nothrow).]])
+ define_property(TARGET PROPERTY WITH_CXX_RTTI
+ BRIEF_DOCS "Enable C++ RTTI on this target"
+ FULL_DOCS [[
+Enables run-time type information.
+Enable this if the module uses typeid or dynamic_cast. You will probably need to link
yith cpprt as well, if you are not already using STL.]])
+
+
if(DBG)
add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
else()
diff --git a/base/applications/atactl/CMakeLists.txt
b/base/applications/atactl/CMakeLists.txt
index 0070358fae4..e75dbbd7569 100644
--- a/base/applications/atactl/CMakeLists.txt
+++ b/base/applications/atactl/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
add_definitions(-DUSER_MODE)
include_directories(${REACTOS_SOURCE_DIR}/drivers/storage/ide/uniata)
add_executable(atactl atactl.cpp atactl.rc)
diff --git a/base/applications/charmap_new/CMakeLists.txt
b/base/applications/charmap_new/CMakeLists.txt
index 3863bca6eb3..0e260478191 100644
--- a/base/applications/charmap_new/CMakeLists.txt
+++ b/base/applications/charmap_new/CMakeLists.txt
@@ -1,14 +1,12 @@
PROJECT(CHARMAP)
-set_cpp(WITH_RTTI WITH_RUNTIME WITH_EXCEPTIONS)
-
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
endif()
include_directories(
- ${REACTOS_SOURCE_DIR}/sdk/lib/atl
+ ${REACTOS_SOURCE_DIR}/sdk/lib/atl
includes)
list(APPEND SOURCE
@@ -21,7 +19,8 @@ add_library(charmap MODULE
charmap.rc)
set_module_type(charmap win32gui UNICODE)
-target_link_libraries(charmap uuid wine)
+target_link_libraries(charmap uuid wine cpprt)
+set_target_cpp_properties(charmap WITH_EXCEPTIONS WITH_RTTI)
add_importlibs(charmap advapi32 user32 gdi32 comctl32 version msvcrt kernel32 ole32
uxtheme ntdll)
add_pch(charmap precomp.h SOURCE)
add_cd_file(TARGET charmap DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/drwtsn32/CMakeLists.txt
b/base/applications/drwtsn32/CMakeLists.txt
index fbc210b5b89..55d5f6ce497 100644
--- a/base/applications/drwtsn32/CMakeLists.txt
+++ b/base/applications/drwtsn32/CMakeLists.txt
@@ -1,7 +1,6 @@
PROJECT(drwtsn32)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS WITH_STL)
include_directories(
${REACTOS_SOURCE_DIR}/sdk/lib/atl
${REACTOS_SOURCE_DIR}/sdk/lib/udmihelp)
@@ -17,6 +16,7 @@ list(APPEND CPP_SOURCE
add_executable(drwtsn32 ${CPP_SOURCE} drwtsn32.rc)
add_pch(drwtsn32 precomp.h CPP_SOURCE)
set_module_type(drwtsn32 win32gui UNICODE)
-target_link_libraries(drwtsn32 udmihelp)
+target_link_libraries(drwtsn32 udmihelp cppstl)
+set_target_cpp_properties(drwtsn32 WITH_EXCEPTIONS)
add_importlibs(drwtsn32 dbghelp psapi advapi32 shell32 shlwapi msvcrt user32 kernel32
ntdll)
add_cd_file(TARGET drwtsn32 DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/fltmc/CMakeLists.txt
b/base/applications/fltmc/CMakeLists.txt
index 01bf7a3a261..3e0aa70635d 100644
--- a/base/applications/fltmc/CMakeLists.txt
+++ b/base/applications/fltmc/CMakeLists.txt
@@ -2,11 +2,11 @@
remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
add_definitions(-D_WIN32_WINNT=0x601)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
-
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
add_executable(fltmc fltmc.cpp fltmc.rc)
+target_link_libraries(fltmc cpprt)
+set_target_cpp_properties(fltmc WITH_EXCEPTIONS)
set_module_type(fltmc win32cui UNICODE)
add_importlibs(fltmc fltlib msvcrt kernel32 advapi32)
add_cd_file(TARGET fltmc DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/games/solitaire/CMakeLists.txt
b/base/applications/games/solitaire/CMakeLists.txt
index 9cb672325d8..a0f083774ad 100644
--- a/base/applications/games/solitaire/CMakeLists.txt
+++ b/base/applications/games/solitaire/CMakeLists.txt
@@ -1,7 +1,4 @@
-set_cpp(WITH_RUNTIME)
-include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/cardlib)
-
list(APPEND SOURCE
solcreate.cpp
solgame.cpp
diff --git a/base/applications/games/spider/CMakeLists.txt
b/base/applications/games/spider/CMakeLists.txt
index 59480763548..78d4f64d7aa 100644
--- a/base/applications/games/spider/CMakeLists.txt
+++ b/base/applications/games/spider/CMakeLists.txt
@@ -1,10 +1,4 @@
-set_cpp(WITH_RUNTIME)
-
-include_directories(
- ${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/cardlib
- ${CMAKE_CURRENT_SOURCE_DIR})
-
list(APPEND SOURCE
spider.cpp
spigame.cpp
@@ -13,6 +7,7 @@ list(APPEND SOURCE
add_rc_deps(rsrc.rc ${CMAKE_CURRENT_SOURCE_DIR}/spider.ico)
add_executable(spider ${SOURCE} rsrc.rc)
target_link_libraries(spider cardlib)
+target_include_directories(spider PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_pch(spider spider.h SOURCE)
set_module_type(spider win32gui UNICODE)
add_importlibs(spider advapi32 comctl32 user32 gdi32 msvcrt kernel32)
diff --git a/base/applications/msconfig_new/CMakeLists.txt
b/base/applications/msconfig_new/CMakeLists.txt
index 0fc32ec5360..5d8ebbe3bd9 100644
--- a/base/applications/msconfig_new/CMakeLists.txt
+++ b/base/applications/msconfig_new/CMakeLists.txt
@@ -1,8 +1,6 @@
PROJECT(msconfig_new)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
-
include_directories(
.
comctl32ex
@@ -35,6 +33,7 @@ add_rc_deps(msconfig.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/msconfig.ico)
add_executable(msconfig_new ${C_SOURCE} ${CPP_SOURCE} msconfig.rc)
add_pch(msconfig_new precomp.h CPP_SOURCE)
set_module_type(msconfig_new win32gui UNICODE)
-target_link_libraries(msconfig_new comsupp)
+target_link_libraries(msconfig_new comsupp cpprt)
+set_target_cpp_properties(msconfig_new WITH_EXCEPTIONS)
add_importlibs(msconfig_new user32 gdi32 comctl32 comdlg32 advapi32 version ole32
oleaut32 msxml3 shell32 shlwapi msvcrt kernel32)
add_cd_file(TARGET msconfig_new DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/mspaint/CMakeLists.txt
b/base/applications/mspaint/CMakeLists.txt
index b07e10d4ce0..c5ba106ba85 100644
--- a/base/applications/mspaint/CMakeLists.txt
+++ b/base/applications/mspaint/CMakeLists.txt
@@ -1,7 +1,6 @@
project(MSPAINT)
add_definitions(-DINITGUID)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -33,7 +32,8 @@ file(GLOB mspaint_rc_deps icons/*.*)
add_rc_deps(rsrc.rc ${mspaint_rc_deps})
add_executable(mspaint ${SOURCE} rsrc.rc)
set_module_type(mspaint win32gui UNICODE)
-target_link_libraries(mspaint uuid)
+target_link_libraries(mspaint uuid cpprt)
+set_target_cpp_properties(mspaint WITH_EXCEPTIONS)
add_importlibs(mspaint hhctrl comdlg32 shell32 user32 gdi32 advapi32 comctl32 msvcrt
kernel32 rpcrt4 shlwapi)
add_pch(mspaint precomp.h SOURCE)
add_cd_file(TARGET mspaint DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/network/telnet/CMakeLists.txt
b/base/applications/network/telnet/CMakeLists.txt
index 8e586fa363b..acd2aa06cba 100644
--- a/base/applications/network/telnet/CMakeLists.txt
+++ b/base/applications/network/telnet/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_EXCEPTIONS WITH_STL)
-
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
if(NOT MSVC)
@@ -34,6 +32,8 @@ if(NOT MSVC)
endif()
add_executable(telnet ${SOURCE} telnet.rc)
+target_link_libraries(telnet cppstl)
+set_target_cpp_properties(telnet WITH_EXCEPTIONS)
set_module_type(telnet win32cui)
add_importlibs(telnet ws2_32 user32 msvcrt kernel32 ntdll)
add_pch(telnet precomp.h SOURCE)
diff --git a/base/applications/rapps/CMakeLists.txt
b/base/applications/rapps/CMakeLists.txt
index 62a61d24b95..0616ddd4468 100644
--- a/base/applications/rapps/CMakeLists.txt
+++ b/base/applications/rapps/CMakeLists.txt
@@ -1,7 +1,5 @@
project(rapps)
-set_cpp(WITH_RUNTIME)
-
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/cryptlib)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
@@ -46,7 +44,7 @@ file(GLOB_RECURSE rapps_rc_deps res/*.*)
add_rc_deps(rapps.rc ${rapps_rc_deps})
add_executable(rapps ${SOURCE} rapps.rc)
set_module_type(rapps win32cui UNICODE)
-target_link_libraries(rapps conutils ${PSEH_LIB} uuid wine)
+target_link_libraries(rapps conutils ${PSEH_LIB} uuid wine cpprt)
add_importlibs(rapps advapi32 comctl32 gdi32 wininet user32 shell32 shlwapi ole32
setupapi gdiplus msvcrt kernel32 ntdll)
add_pch(rapps include/rapps.h SOURCE)
add_dependencies(rapps rappsmsg)
diff --git a/base/applications/sndrec32/CMakeLists.txt
b/base/applications/sndrec32/CMakeLists.txt
index 83809d2d480..3a97846df2a 100644
--- a/base/applications/sndrec32/CMakeLists.txt
+++ b/base/applications/sndrec32/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_RUNTIME)
-
list(APPEND SOURCE
audio_format.cpp
audio_membuffer.cpp
@@ -15,6 +13,7 @@ list(APPEND SOURCE
file(GLOB sndrec32_rc_deps resources/*.*)
add_rc_deps(rsrc.rc ${sndrec32_rc_deps})
add_executable(sndrec32 ${SOURCE} rsrc.rc)
+target_link_libraries(sndrec32 cpprt)
set_module_type(sndrec32 win32gui UNICODE)
add_importlibs(sndrec32 winmm user32 msacm32 comctl32 comdlg32 gdi32 shell32 msvcrt
kernel32)
add_pch(sndrec32 stdafx.h SOURCE)
diff --git a/base/shell/explorer/CMakeLists.txt b/base/shell/explorer/CMakeLists.txt
index 18562492378..33d90444fbf 100644
--- a/base/shell/explorer/CMakeLists.txt
+++ b/base/shell/explorer/CMakeLists.txt
@@ -1,6 +1,5 @@
PROJECT(SHELL)
-set_cpp(WITH_RUNTIME)
add_definitions(-D_ATL_NO_EXCEPTIONS)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -31,7 +30,7 @@ list(APPEND SOURCE
file(GLOB explorer_rc_deps res/*.*)
add_rc_deps(explorer.rc ${explorer_rc_deps})
add_executable(explorer ${SOURCE} explorer.rc)
-target_link_libraries(explorer uuid wine)
+target_link_libraries(explorer uuid wine cpprt)
set_module_type(explorer win32gui UNICODE)
add_importlibs(explorer advapi32 gdi32 user32 comctl32 ole32 oleaut32 shell32 browseui
shlwapi shdocvw version uxtheme msvcrt kernel32 ntdll)
add_pch(explorer precomp.h SOURCE)
diff --git a/base/shell/rshell/CMakeLists.txt b/base/shell/rshell/CMakeLists.txt
index a2722178bbd..c47a121699f 100644
--- a/base/shell/rshell/CMakeLists.txt
+++ b/base/shell/rshell/CMakeLists.txt
@@ -3,8 +3,6 @@ PROJECT(SHELL)
add_definitions(
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
-
include_directories(
${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -24,7 +22,8 @@ target_link_libraries(rshell
shellmenu
shelldesktop
uuid
- wine)
+ wine
+ cpprt)
add_importlibs(rshell
browseui
@@ -40,14 +39,14 @@ add_importlibs(rshell
kernel32
ntdll)
-add_custom_command(TARGET rshell POST_BUILD
- COMMAND "${CMAKE_COMMAND}" -E copy
+add_custom_command(TARGET rshell POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:rshell>"
- "$<TARGET_FILE_DIR:explorer>/$<TARGET_FILE_NAME:rshell>"
+ "$<TARGET_FILE_DIR:explorer>/$<TARGET_FILE_NAME:rshell>"
COMMENT "Copying to output directory")
-add_custom_command(TARGET rshell POST_BUILD
- COMMAND "${CMAKE_COMMAND}" -E copy
+add_custom_command(TARGET rshell POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:rshell>"
- "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:rshell>"
+ "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:rshell>"
COMMENT "Copying to output directory")
diff --git a/dll/directx/ksproxy/CMakeLists.txt b/dll/directx/ksproxy/CMakeLists.txt
index 15d7ebc0bfe..b6d070d6385 100644
--- a/dll/directx/ksproxy/CMakeLists.txt
+++ b/dll/directx/ksproxy/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp(WITH_STL)
spec2def(ksproxy.ax ksproxy.spec)
list(APPEND SOURCE
@@ -25,7 +24,7 @@ list(APPEND SOURCE
add_library(ksproxy MODULE ${SOURCE} ksproxy.rc)
set_module_type(ksproxy win32dll)
set_target_properties(ksproxy PROPERTIES SUFFIX ".ax")
-target_link_libraries(ksproxy strmiids)
+target_link_libraries(ksproxy strmiids cppstl)
add_importlibs(ksproxy advapi32 ole32 setupapi ksuser msvcrt kernel32 ntdll)
add_dependencies(ksproxy dxsdk)
add_cd_file(TARGET ksproxy DESTINATION reactos/system32 FOR all)
diff --git a/dll/opengl/glu32/CMakeLists.txt b/dll/opengl/glu32/CMakeLists.txt
index b2e6de97f2f..490732e6d49 100644
--- a/dll/opengl/glu32/CMakeLists.txt
+++ b/dll/opengl/glu32/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_RUNTIME)
-
include_directories(BEFORE
include
src/include
@@ -118,6 +116,7 @@ add_library(glu32 MODULE
${PCH_SKIP_SOURCE}
glu32.rc
${CMAKE_CURRENT_BINARY_DIR}/glu32.def)
+target_link_libraries(glu32 cpprt)
set_module_type(glu32 win32dll)
diff --git a/dll/shellext/acppage/CMakeLists.txt b/dll/shellext/acppage/CMakeLists.txt
index f4dc6e1c011..a8708a53b7f 100644
--- a/dll/shellext/acppage/CMakeLists.txt
+++ b/dll/shellext/acppage/CMakeLists.txt
@@ -1,7 +1,6 @@
project(appcompat)
-set_cpp(WITH_RUNTIME)
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
@@ -32,7 +31,7 @@ add_library(acppage MODULE
${CMAKE_CURRENT_BINARY_DIR}/acppage.def)
set_module_type(acppage win32dll UNICODE)
-target_link_libraries(acppage wine uuid)
+target_link_libraries(acppage wine uuid cpprt)
add_delay_importlibs(acppage apphelp ole32 oleaut32 shlwapi comctl32 sfc_os)
add_importlibs(acppage shell32 user32 advapi32 msvcrt kernel32)
add_pch(acppage precomp.h SOURCE)
diff --git a/dll/shellext/fontext/CMakeLists.txt b/dll/shellext/fontext/CMakeLists.txt
index e50eebfa95b..5ceac5671fa 100644
--- a/dll/shellext/fontext/CMakeLists.txt
+++ b/dll/shellext/fontext/CMakeLists.txt
@@ -5,7 +5,6 @@ add_definitions(
remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601)
-set_cpp(WITH_RUNTIME)
spec2def(fontext.dll fontext.spec)
@@ -32,7 +31,7 @@ add_library(fontext MODULE
${CMAKE_CURRENT_BINARY_DIR}/fontext.def)
set_module_type(fontext win32dll UNICODE)
-target_link_libraries(fontext uuid wine)
+target_link_libraries(fontext uuid wine cpprt)
add_delay_importlibs(fontext ole32 oleaut32 shlwapi gdi32)
add_importlibs(fontext shell32 advapi32 user32 msvcrt kernel32 ntdll)
add_pch(fontext precomp.h SOURCE)
diff --git a/dll/shellext/mydocs/CMakeLists.txt b/dll/shellext/mydocs/CMakeLists.txt
index 0c9649c25f4..4abbd640d6d 100644
--- a/dll/shellext/mydocs/CMakeLists.txt
+++ b/dll/shellext/mydocs/CMakeLists.txt
@@ -1,4 +1,3 @@
-set_cpp(WITH_RUNTIME)
spec2def(mydocs.dll mydocs.spec)
add_definitions(
@@ -28,7 +27,7 @@ add_library(mydocs MODULE
${CMAKE_CURRENT_BINARY_DIR}/mydocs.def)
set_module_type(mydocs win32dll UNICODE)
-target_link_libraries(mydocs uuid wine)
+target_link_libraries(mydocs uuid wine cpprt)
add_delay_importlibs(mydocs ole32 oleaut32)
add_importlibs(mydocs advapi32 shell32 user32 comctl32 shlwapi msvcrt kernel32 ntdll)
add_pch(mydocs precomp.hpp SOURCE)
diff --git a/dll/shellext/netshell/CMakeLists.txt b/dll/shellext/netshell/CMakeLists.txt
index 2ed317395d0..4302187660d 100644
--- a/dll/shellext/netshell/CMakeLists.txt
+++ b/dll/shellext/netshell/CMakeLists.txt
@@ -1,7 +1,6 @@
project(SHELL)
-set_cpp(WITH_RUNTIME)
if(NOT MSVC)
# HACK: this should be enabled globally!
@@ -41,7 +40,7 @@ add_library(netshell MODULE
${CMAKE_CURRENT_BINARY_DIR}/netshell.def)
set_module_type(netshell win32dll UNICODE)
-target_link_libraries(netshell uuid wine)
+target_link_libraries(netshell uuid wine cpprt)
add_delay_importlibs(netshell ole32 oleaut32 shlwapi shell32)
add_importlibs(netshell version iphlpapi gdi32 user32 advapi32 setupapi ws2_32 comctl32
msvcrt kernel32 ntdll)
add_pch(netshell precomp.h "${PCH_SKIP_SOURCE}")
diff --git a/dll/shellext/ntobjshex/CMakeLists.txt
b/dll/shellext/ntobjshex/CMakeLists.txt
index 3015c649947..91132a405c0 100644
--- a/dll/shellext/ntobjshex/CMakeLists.txt
+++ b/dll/shellext/ntobjshex/CMakeLists.txt
@@ -4,7 +4,6 @@ project(SHELL)
add_definitions(
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
if(NOT MSVC)
# HACK: this should be enabled globally!
@@ -33,7 +32,7 @@ add_library(ntobjshex MODULE
${CMAKE_CURRENT_BINARY_DIR}/ntobjshex.def)
set_module_type(ntobjshex win32dll UNICODE)
-target_link_libraries(ntobjshex uuid wine)
+target_link_libraries(ntobjshex uuid wine cpprt)
add_importlibs(ntobjshex
advapi32
diff --git a/dll/shellext/sendmail/CMakeLists.txt b/dll/shellext/sendmail/CMakeLists.txt
index 51128933c18..52d0a3943ca 100644
--- a/dll/shellext/sendmail/CMakeLists.txt
+++ b/dll/shellext/sendmail/CMakeLists.txt
@@ -1,4 +1,3 @@
-set_cpp(WITH_RUNTIME)
spec2def(sendmail.dll sendmail.spec)
add_definitions(
@@ -28,7 +27,7 @@ add_library(sendmail MODULE
${CMAKE_CURRENT_BINARY_DIR}/sendmail.def)
set_module_type(sendmail win32dll UNICODE)
-target_link_libraries(sendmail uuid wine)
+target_link_libraries(sendmail uuid wine cpprt)
add_delay_importlibs(sendmail ole32 oleaut32)
add_importlibs(sendmail advapi32 shell32 user32 comctl32 shlwapi msvcrt kernel32 ntdll)
add_pch(sendmail precomp.hpp SOURCE)
diff --git a/dll/shellext/shellbtrfs/CMakeLists.txt
b/dll/shellext/shellbtrfs/CMakeLists.txt
index c8fdc857001..7a21c8aa6de 100644
--- a/dll/shellext/shellbtrfs/CMakeLists.txt
+++ b/dll/shellext/shellbtrfs/CMakeLists.txt
@@ -1,4 +1,3 @@
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS WITH_STL)
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x603)
@@ -39,7 +38,8 @@ file(GLOB shellbtrfs_rc_deps *.ico)
add_rc_deps(shellbtrfs.rc ${shellbtrfs_rc_deps})
set_module_type(shellbtrfs win32dll UNICODE)
-target_link_libraries(shellbtrfs uuid)
+target_link_libraries(shellbtrfs uuid cppstl)
+set_target_cpp_properties(shellbtrfs WITH_EXCEPTIONS)
add_importlibs(shellbtrfs advapi32 advapi32_vista ole32 shell32 shlwapi user32 comctl32
uxtheme setupapi comdlg32 gdi32 msvcrt kernel32_vista kernel32 ntdll)
add_pch(shellbtrfs precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET shellbtrfs DESTINATION reactos/system32 FOR all)
diff --git a/dll/shellext/stobject/CMakeLists.txt b/dll/shellext/stobject/CMakeLists.txt
index 411dab205d3..15d9206589b 100644
--- a/dll/shellext/stobject/CMakeLists.txt
+++ b/dll/shellext/stobject/CMakeLists.txt
@@ -1,8 +1,6 @@
project(SHELL)
-set_cpp(WITH_RUNTIME)
-
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
@@ -34,7 +32,7 @@ add_library(stobject MODULE
${CMAKE_CURRENT_BINARY_DIR}/stobject.def)
set_module_type(stobject win32dll UNICODE)
-target_link_libraries(stobject uuid wine)
+target_link_libraries(stobject uuid wine cpprt)
add_importlibs(stobject
setupapi
diff --git a/dll/shellext/zipfldr/CMakeLists.txt b/dll/shellext/zipfldr/CMakeLists.txt
index f0339f9a6ff..4459b9d60d6 100644
--- a/dll/shellext/zipfldr/CMakeLists.txt
+++ b/dll/shellext/zipfldr/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
@@ -47,7 +46,8 @@ add_library(zipfldr MODULE
set_module_type(zipfldr win32dll UNICODE)
-target_link_libraries(zipfldr minizip zlib uuid)
+target_link_libraries(zipfldr minizip zlib uuid cpprt)
+set_target_cpp_properties(zipfldr WITH_EXCEPTIONS)
add_importlibs(zipfldr oleaut32 ole32 shlwapi comctl32 shell32 user32 advapi32 msvcrt
kernel32 ntdll)
add_pch(zipfldr precomp.h SOURCE)
add_cd_file(TARGET zipfldr DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/browseui/CMakeLists.txt b/dll/win32/browseui/CMakeLists.txt
index 5c136cd02cb..1aa48b83117 100644
--- a/dll/win32/browseui/CMakeLists.txt
+++ b/dll/win32/browseui/CMakeLists.txt
@@ -3,8 +3,6 @@ PROJECT(SHELL)
add_subdirectory(shellbars)
add_subdirectory(shellfind)
-set_cpp(WITH_RUNTIME)
-
add_definitions(
-D_ATL_NO_EXCEPTIONS)
@@ -49,7 +47,7 @@ add_library(browseui MODULE
${CMAKE_CURRENT_BINARY_DIR}/browseui.def)
set_module_type(browseui win32dll UNICODE)
-target_link_libraries(browseui shellbars shellfind uuid wine)
+target_link_libraries(browseui shellbars shellfind uuid wine cpprt)
add_importlibs(browseui uxtheme shlwapi shell32 comctl32 gdi32 ole32 oleaut32 user32
advapi32 mpr msvcrt kernel32 ntdll)
add_pch(browseui precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
@@ -62,8 +60,8 @@ if(NOT MSVC)
endif()
endif()
-add_custom_command(TARGET browseui POST_BUILD
- COMMAND "${CMAKE_COMMAND}" -E copy
+add_custom_command(TARGET browseui POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:browseui>"
- "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:browseui>"
+ "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:browseui>"
COMMENT "Copying to output directory")
diff --git a/dll/win32/browseui/shellbars/CMakeLists.txt
b/dll/win32/browseui/shellbars/CMakeLists.txt
index 661284c0386..221de1777b2 100644
--- a/dll/win32/browseui/shellbars/CMakeLists.txt
+++ b/dll/win32/browseui/shellbars/CMakeLists.txt
@@ -1,8 +1,6 @@
PROJECT(SHELL)
-set_cpp(WITH_RUNTIME)
-
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_ATL_NO_EXCEPTIONS)
diff --git a/dll/win32/browseui/shellfind/CMakeLists.txt
b/dll/win32/browseui/shellfind/CMakeLists.txt
index 0d7fd02d398..5900ed9ae11 100644
--- a/dll/win32/browseui/shellfind/CMakeLists.txt
+++ b/dll/win32/browseui/shellfind/CMakeLists.txt
@@ -1,8 +1,6 @@
PROJECT(SHELL)
-set_cpp(WITH_RUNTIME)
-
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_ATL_NO_EXCEPTIONS)
diff --git a/dll/win32/devmgr/CMakeLists.txt b/dll/win32/devmgr/CMakeLists.txt
index 88b24753e5c..f805b3f9ae6 100644
--- a/dll/win32/devmgr/CMakeLists.txt
+++ b/dll/win32/devmgr/CMakeLists.txt
@@ -2,8 +2,6 @@ PROJECT(DEVMGR)
spec2def(devmgr.dll devmgr.spec ADD_IMPORTLIB)
-set_cpp(WITH_RTTI WITH_RUNTIME WITH_EXCEPTIONS)
-
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
@@ -11,7 +9,7 @@ endif()
include_directories(
${REACTOS_SOURCE_DIR}/sdk/include/reactos/dll
- ${REACTOS_SOURCE_DIR}/sdk/lib/atl
+ ${REACTOS_SOURCE_DIR}/sdk/lib/atl
includes)
list(APPEND SOURCE
@@ -35,7 +33,8 @@ add_library(devmgr MODULE
${CMAKE_CURRENT_BINARY_DIR}/devmgr.def)
set_module_type(devmgr win32dll UNICODE)
-target_link_libraries(devmgr uuid wine)
+target_link_libraries(devmgr uuid wine cpprt)
+set_target_cpp_properties(devmgr WITH_EXCEPTIONS WITH_RTTI)
add_importlibs(devmgr setupapi advapi32 shell32 newdev user32 gdi32 comctl32 version
msvcrt kernel32 ole32 oleaut32 uxtheme ntdll)
add_pch(devmgr precomp.h SOURCE)
add_cd_file(TARGET devmgr DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/framedyn/CMakeLists.txt b/dll/win32/framedyn/CMakeLists.txt
index edc6ab7c7c2..922ead719e9 100644
--- a/dll/win32/framedyn/CMakeLists.txt
+++ b/dll/win32/framedyn/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
spec2def(framedyn.dll framedyn.spec ADD_IMPORTLIB)
list(APPEND SOURCE
@@ -13,6 +12,8 @@ if(MSVC)
endif()
add_library(framedyn MODULE ${SOURCE})
+target_link_libraries(framedyn cpprt)
+set_target_cpp_properties(framedyn WITH_EXCEPTIONS)
set_module_type(framedyn win32dll UNICODE)
add_importlibs(framedyn oleaut32 msvcrt kernel32 ntdll)
add_cd_file(TARGET framedyn DESTINATION reactos/system32/wbem FOR all)
diff --git a/dll/win32/msgina/CMakeLists.txt b/dll/win32/msgina/CMakeLists.txt
index 5f3fa9ece15..056b602788d 100644
--- a/dll/win32/msgina/CMakeLists.txt
+++ b/dll/win32/msgina/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp(WITH_RUNTIME)
add_definitions(
-D_ATL_NO_EXCEPTIONS)
@@ -29,7 +28,7 @@ add_library(msgina MODULE
${CMAKE_CURRENT_BINARY_DIR}/msgina.def)
set_module_type(msgina win32dll UNICODE)
-target_link_libraries(msgina wine uuid ${PSEH_LIB})
+target_link_libraries(msgina wine uuid ${PSEH_LIB} cpprt)
add_delay_importlibs(msgina secur32)
add_importlibs(msgina advapi32 user32 gdi32 powrprof userenv msvcrt kernel32 ntdll)
add_pch(msgina msgina.h "${PCH_SKIP_SOURCE}")
diff --git a/dll/win32/shell32/CMakeLists.txt b/dll/win32/shell32/CMakeLists.txt
index 5c812e953e4..a76c13af22e 100644
--- a/dll/win32/shell32/CMakeLists.txt
+++ b/dll/win32/shell32/CMakeLists.txt
@@ -4,7 +4,6 @@ add_subdirectory(shelldesktop)
add_subdirectory(shellmenu)
add_subdirectory(shellrecyclebin)
-set_cpp(WITH_RUNTIME)
spec2def(shell32.dll shell32.spec ADD_IMPORTLIB)
if(NOT MSVC)
@@ -122,7 +121,7 @@ add_typelib(shell32_shldisp.idl)
set_source_files_properties(shell32.rc PROPERTIES OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/shell32_shldisp.tlb)
set_module_type(shell32 win32dll UNICODE)
-target_link_libraries(shell32 shellmenu shelldesktop wine uuid recyclebin)
+target_link_libraries(shell32 shellmenu shelldesktop wine uuid recyclebin cpprt)
add_delay_importlibs(shell32 powrprof shdocvw devmgr winspool.drv winmm mpr uxtheme ole32
oleaut32 userenv browseui version fmifs)
add_importlibs(shell32 advapi32 gdi32 user32 comctl32 comdlg32 shlwapi msvcrt kernel32
ntdll)
add_dependencies(shell32 stdole2) # shell32_shldisp.tlb needs stdole2.tlb
diff --git a/dll/win32/shell32/shelldesktop/CMakeLists.txt
b/dll/win32/shell32/shelldesktop/CMakeLists.txt
index 2ea167b95f7..7da3e7b14a4 100644
--- a/dll/win32/shell32/shelldesktop/CMakeLists.txt
+++ b/dll/win32/shell32/shelldesktop/CMakeLists.txt
@@ -1,7 +1,5 @@
project(SHELL)
-set_cpp(WITH_RUNTIME)
-
add_definitions(
-DUNICODE
-D_UNICODE
diff --git a/dll/win32/shell32/shellmenu/CMakeLists.txt
b/dll/win32/shell32/shellmenu/CMakeLists.txt
index ebca89a0226..94c04fc8515 100644
--- a/dll/win32/shell32/shellmenu/CMakeLists.txt
+++ b/dll/win32/shell32/shellmenu/CMakeLists.txt
@@ -1,7 +1,5 @@
project(SHELL)
-set_cpp(WITH_RUNTIME)
-
add_definitions(
-DUNICODE
-D_UNICODE
diff --git a/dll/win32/shlwapi/CMakeLists.txt b/dll/win32/shlwapi/CMakeLists.txt
index 6c425e78ceb..0e166a33223 100644
--- a/dll/win32/shlwapi/CMakeLists.txt
+++ b/dll/win32/shlwapi/CMakeLists.txt
@@ -9,7 +9,6 @@ add_definitions(
-D_SHLWAPI_
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
include_directories(BEFORE
${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine
${REACTOS_SOURCE_DIR}/sdk/lib/atl)
diff --git a/drivers/filesystems/udfs/CMakeLists.txt
b/drivers/filesystems/udfs/CMakeLists.txt
index 8c13bf7d861..292fe2421e3 100644
--- a/drivers/filesystems/udfs/CMakeLists.txt
+++ b/drivers/filesystems/udfs/CMakeLists.txt
@@ -1,8 +1,6 @@
include_directories(Include)
-set_cpp(WITH_RUNTIME)
-
list(APPEND SOURCE
udf_info/alloc.cpp
udf_info/dirtree.cpp
diff --git a/drivers/storage/ide/uniata/CMakeLists.txt
b/drivers/storage/ide/uniata/CMakeLists.txt
index 163174825a4..f8f952a5a79 100644
--- a/drivers/storage/ide/uniata/CMakeLists.txt
+++ b/drivers/storage/ide/uniata/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
include_directories(
BEFORE ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/drivers/usb/usbaudio/CMakeLists.txt b/drivers/usb/usbaudio/CMakeLists.txt
index 2262caa6066..218eaec61fd 100644
--- a/drivers/usb/usbaudio/CMakeLists.txt
+++ b/drivers/usb/usbaudio/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
diff --git a/drivers/wdm/audio/backpln/portcls/CMakeLists.txt
b/drivers/wdm/audio/backpln/portcls/CMakeLists.txt
index 294b48c9f8c..a873b75fe2a 100644
--- a/drivers/wdm/audio/backpln/portcls/CMakeLists.txt
+++ b/drivers/wdm/audio/backpln/portcls/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
diff --git a/drivers/wdm/audio/drivers/CMIDriver/CMakeLists.txt
b/drivers/wdm/audio/drivers/CMIDriver/CMakeLists.txt
index ba6cd3f9c4c..564c5e42212 100644
--- a/drivers/wdm/audio/drivers/CMIDriver/CMakeLists.txt
+++ b/drivers/wdm/audio/drivers/CMIDriver/CMakeLists.txt
@@ -2,7 +2,6 @@
add_subdirectory(cmicontrol)
add_subdirectory(cpl)
-set_cpp()
# for WaveRT support
remove_definitions(-D_WIN32_WINNT=0x502)
diff --git a/drivers/wdm/audio/drivers/CMIDriver/cmicontrol/CMakeLists.txt
b/drivers/wdm/audio/drivers/CMIDriver/cmicontrol/CMakeLists.txt
index aeff43e3db7..8574b420629 100644
--- a/drivers/wdm/audio/drivers/CMIDriver/cmicontrol/CMakeLists.txt
+++ b/drivers/wdm/audio/drivers/CMIDriver/cmicontrol/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
include_directories(..)
add_executable(cmicontrol main.cpp window.rc)
diff --git a/drivers/wdm/audio/drivers/CMIDriver/cpl/CMakeLists.txt
b/drivers/wdm/audio/drivers/CMIDriver/cpl/CMakeLists.txt
index 2ee32c73ac0..95c5a7fb7ae 100644
--- a/drivers/wdm/audio/drivers/CMIDriver/cpl/CMakeLists.txt
+++ b/drivers/wdm/audio/drivers/CMIDriver/cpl/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
add_library(cmicpl MODULE
cmicpl.cpp
diff --git a/drivers/wdm/audio/hdaudbus/CMakeLists.txt
b/drivers/wdm/audio/hdaudbus/CMakeLists.txt
index 3c5883dc64f..d129c3e8b1c 100644
--- a/drivers/wdm/audio/hdaudbus/CMakeLists.txt
+++ b/drivers/wdm/audio/hdaudbus/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
diff --git a/modules/rosapps/applications/devutils/gdb2/CMakeLists.txt
b/modules/rosapps/applications/devutils/gdb2/CMakeLists.txt
index e3b71b498df..b427fdd57d0 100644
--- a/modules/rosapps/applications/devutils/gdb2/CMakeLists.txt
+++ b/modules/rosapps/applications/devutils/gdb2/CMakeLists.txt
@@ -1,6 +1,6 @@
-set_cpp(WITH_RUNTIME)
add_executable(gdb2 gdb2.cpp)
+target_link_libraries(gdb2 cpprt)
set_module_type(gdb2 win32cui)
add_importlibs(gdb2 user32 msvcrt kernel32)
add_cd_file(TARGET gdb2 DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/devutils/shlextdbg/CMakeLists.txt
b/modules/rosapps/applications/devutils/shlextdbg/CMakeLists.txt
index 232244049b8..2f6541bb389 100644
--- a/modules/rosapps/applications/devutils/shlextdbg/CMakeLists.txt
+++ b/modules/rosapps/applications/devutils/shlextdbg/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp(WITH_RUNTIME)
add_definitions(-D_ATL_NO_EXCEPTIONS)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -7,6 +6,6 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
add_executable(shlextdbg shlextdbg.cpp shlextdbg.rc)
set_module_type(shlextdbg win32cui UNICODE)
-target_link_libraries(shlextdbg uuid)
+target_link_libraries(shlextdbg uuid cpprt)
add_importlibs(shlextdbg ole32 comctl32 shell32 user32 msvcrt kernel32)
add_cd_file(TARGET shlextdbg DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/explorer-old/CMakeLists.txt
b/modules/rosapps/applications/explorer-old/CMakeLists.txt
index ca824c486f2..82c7d75c658 100644
--- a/modules/rosapps/applications/explorer-old/CMakeLists.txt
+++ b/modules/rosapps/applications/explorer-old/CMakeLists.txt
@@ -1,8 +1,6 @@
add_subdirectory(notifyhook)
-set_cpp(WITH_RTTI WITH_EXCEPTIONS WITH_STL)
-
add_definitions(
-DWIN32
-D__WINDRES__)
@@ -53,7 +51,8 @@ add_executable(explorer_old
${PCH_SKIP_SOURCE}
explorer.rc)
-target_link_libraries(explorer_old comsupp wine uuid)
+target_link_libraries(explorer_old comsupp wine uuid cppstl)
+set_target_cpp_properties(explorer_old WITH_EXCEPTIONS WITH_RTTI)
set_module_type(explorer_old win32gui UNICODE)
add_importlibs(explorer_old advapi32 gdi32 user32 ws2_32 msimg32 comctl32 ole32 oleaut32
shell32 shlwapi notifyhook msvcrt kernel32 ntdll)
add_pch(explorer_old precomp.h "${PCH_SKIP_SOURCE}")
diff --git a/modules/rosapps/applications/fraginator/CMakeLists.txt
b/modules/rosapps/applications/fraginator/CMakeLists.txt
index 7526d90bd8b..17d7d28037c 100644
--- a/modules/rosapps/applications/fraginator/CMakeLists.txt
+++ b/modules/rosapps/applications/fraginator/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
-
list(APPEND SOURCE
Fraginator.cpp
MainDialog.cpp
@@ -12,12 +10,16 @@ list(APPEND UNFRAG_SOURCE
DriveVolume.cpp)
add_executable(frag ${SOURCE} ${UNFRAG_SOURCE} Fraginator.rc)
+target_link_libraries(frag cppstl)
+set_target_cpp_properties(frag WITH_EXCEPTIONS)
set_module_type(frag win32gui UNICODE)
add_importlibs(frag user32 advapi32 shell32 comctl32 msvcrt kernel32 ntdll)
add_cd_file(TARGET frag DESTINATION reactos/system32 FOR all)
add_executable(unfrag ${UNFRAG_SOURCE})
+target_link_libraries(unfrag cppstl)
+set_target_cpp_properties(unfrag WITH_EXCEPTIONS)
target_compile_definitions(unfrag PRIVATE "_CUI_")
set_module_type(unfrag win32cui UNICODE)
add_importlibs(unfrag advapi32 msvcrt kernel32 ntdll)
-add_cd_file(TARGET unfrag DESTINATION reactos/system32 FOR all)
\ No newline at end of file
+add_cd_file(TARGET unfrag DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/net/netreg/CMakeLists.txt
b/modules/rosapps/applications/net/netreg/CMakeLists.txt
index 36425680b72..3f1f1784463 100644
--- a/modules/rosapps/applications/net/netreg/CMakeLists.txt
+++ b/modules/rosapps/applications/net/netreg/CMakeLists.txt
@@ -1,6 +1,7 @@
-set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
add_executable(netreg netreg.cpp netreg.rc)
+target_link_libraries(netreg cppstl)
+set_target_cpp_properties(netreg WITH_EXCEPTIONS)
set_module_type(netreg win32cui)
add_importlibs(netreg advapi32 user32 ws2_32 msvcrt kernel32 ntdll)
add_cd_file(TARGET netreg DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/net/roshttpd/CMakeLists.txt
b/modules/rosapps/applications/net/roshttpd/CMakeLists.txt
index 72e02da811f..3cb22768855 100644
--- a/modules/rosapps/applications/net/roshttpd/CMakeLists.txt
+++ b/modules/rosapps/applications/net/roshttpd/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
include_directories(BEFORE include)
add_compile_flags("-D__USE_W32_SOCKETS")
@@ -14,6 +13,8 @@ list(APPEND SOURCE
common/thread.cpp)
add_executable(roshttpd ${SOURCE} common/roshttpd.rc)
+target_link_libraries(roshttpd cppstl)
+set_target_cpp_properties(roshttpd WITH_EXCEPTIONS)
set_module_type(roshttpd win32cui)
add_importlibs(roshttpd user32 ws2_32 msvcrt kernel32)
add_cd_file(TARGET roshttpd DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/sysutils/fontsub/CMakeLists.txt
b/modules/rosapps/applications/sysutils/fontsub/CMakeLists.txt
index 09e1c733ca9..b24ae314ade 100644
--- a/modules/rosapps/applications/sysutils/fontsub/CMakeLists.txt
+++ b/modules/rosapps/applications/sysutils/fontsub/CMakeLists.txt
@@ -1,16 +1,17 @@
# FontSub by Katayama Hirofumi MZ
-#
+#
# To the extent possible under law, the person who associated CC0 with
# FontSub has waived all copyright and related or neighboring rights
# to FontSub.
-#
+#
# You should have received a copy of the CC0 legalcode along with this
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
-set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
-
add_executable(fontsubedit fontsub.cpp fontsub_res.rc)
+target_link_libraries(fontsubedit cppstl)
set_module_type(fontsubedit win32gui UNICODE)
add_importlibs(fontsubedit advapi32 comctl32 comdlg32 shell32 gdi32 user32 msvcrt
kernel32)
-set_target_properties(fontsubedit PROPERTIES OUTPUT_NAME "fontsub")
+set_target_cpp_properties(fontsubedit WITH_EXCEPTIONS)
+set_target_properties(fontsubedit PROPERTIES
+ OUTPUT_NAME "fontsub")
add_cd_file(TARGET fontsubedit DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/applications/sysutils/regexpl/CMakeLists.txt
b/modules/rosapps/applications/sysutils/regexpl/CMakeLists.txt
index 2b767386bf0..1cd493d4887 100644
--- a/modules/rosapps/applications/sysutils/regexpl/CMakeLists.txt
+++ b/modules/rosapps/applications/sysutils/regexpl/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_RUNTIME WITH_STL WITH_EXCEPTIONS)
-
list(APPEND SOURCE
ArgumentParser.cpp
Console.cpp
@@ -31,6 +29,8 @@ list(APPEND SOURCE
Prompt.cpp)
add_executable(regexpl ${SOURCE} regexpl.rc)
+target_link_libraries(regexpl cppstl)
+set_target_cpp_properties(regexpl WITH_EXCEPTIONS)
set_module_type(regexpl win32cui)
add_importlibs(regexpl user32 advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET regexpl DESTINATION reactos/system32 FOR all)
diff --git a/modules/rosapps/lib/vfdlib/CMakeLists.txt
b/modules/rosapps/lib/vfdlib/CMakeLists.txt
index 9dcf9329424..d1c5946fb84 100644
--- a/modules/rosapps/lib/vfdlib/CMakeLists.txt
+++ b/modules/rosapps/lib/vfdlib/CMakeLists.txt
@@ -1,4 +1,3 @@
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS WITH_STL)
spec2def(vfd.dll vfdlib.spec ADD_IMPORTLIB)
@@ -31,7 +30,8 @@ add_library(vfd MODULE
include_directories(${REACTOS_SOURCE_DIR}/modules/rosapps/include/vfd
${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
set_module_type(vfd win32dll ENTRYPOINT DllMain 12)
-target_link_libraries(vfd zlib_solo uuid)
+target_link_libraries(vfd zlib_solo uuid cppstl)
+set_target_cpp_properties(vfd WITH_EXCEPTIONS)
add_importlibs(vfd advapi32 user32 gdi32 shell32 comdlg32 comctl32 ole32 version psapi
msvcrt kernel32 ntdll)
add_dependencies(vfd vfdmsg_lib)
add_cd_file(TARGET vfd DESTINATION reactos/system32 FOR all)
diff --git a/modules/rostests/apitests/apphelp/CMakeLists.txt
b/modules/rostests/apitests/apphelp/CMakeLists.txt
index 5a17d8cbfe7..6bf9ddc0739 100644
--- a/modules/rostests/apitests/apphelp/CMakeLists.txt
+++ b/modules/rostests/apitests/apphelp/CMakeLists.txt
@@ -7,7 +7,6 @@ add_definitions(
-D_UNICODE
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl
${CMAKE_CURRENT_BINARY_DIR})
@@ -26,10 +25,10 @@ list(APPEND SOURCE
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb
COMMAND native-xml2sdb -i ${CMAKE_CURRENT_SOURCE_DIR}/testdb.xml -o
${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/testdb.xml native-xml2sdb)
-
+
add_rc_deps(testdata.rc ${CMAKE_CURRENT_BINARY_DIR}/testdb.sdb)
add_executable(apphelp_apitest ${SOURCE})
set_module_type(apphelp_apitest win32cui)
-target_link_libraries(apphelp_apitest ${PSEH_LIB})
+target_link_libraries(apphelp_apitest ${PSEH_LIB} cpprt)
add_importlibs(apphelp_apitest advapi32 userenv version shlwapi msvcrt kernel32 ntdll)
add_rostests_file(TARGET apphelp_apitest)
diff --git a/modules/rostests/apitests/atl/CMakeLists.txt
b/modules/rostests/apitests/atl/CMakeLists.txt
index c0c3781defd..11ca2fdd72c 100644
--- a/modules/rostests/apitests/atl/CMakeLists.txt
+++ b/modules/rostests/apitests/atl/CMakeLists.txt
@@ -1,6 +1,5 @@
add_definitions(-DINITGUID -DWINETEST_USE_DBGSTR_LONGLONG)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -29,7 +28,8 @@ add_executable(atl_apitest
${PCH_SKIP_SOURCE}
atl_apitest.rc)
-target_link_libraries(atl_apitest wine uuid)
+target_link_libraries(atl_apitest wine uuid cpprt)
+set_target_cpp_properties(atl_apitest WITH_EXCEPTIONS)
set_module_type(atl_apitest win32cui)
add_importlibs(atl_apitest rpcrt4 ole32 oleaut32 msimg32 gdi32 advapi32 user32 msvcrt
kernel32 ntdll)
add_pch(atl_apitest precomp.h "${PCH_SKIP_SOURCE}")
diff --git a/modules/rostests/apitests/browseui/CMakeLists.txt
b/modules/rostests/apitests/browseui/CMakeLists.txt
index 053ca9776c5..2ae9cc3b895 100644
--- a/modules/rostests/apitests/browseui/CMakeLists.txt
+++ b/modules/rostests/apitests/browseui/CMakeLists.txt
@@ -1,12 +1,11 @@
-set_cpp(WITH_RTTI WITH_RUNTIME WITH_EXCEPTIONS)
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
endif()
include_directories(
- ${REACTOS_SOURCE_DIR}/sdk/lib/atl
+ ${REACTOS_SOURCE_DIR}/sdk/lib/atl
includes)
list(APPEND SOURCE
@@ -17,7 +16,9 @@ list(APPEND SOURCE
testlist.c)
add_executable(browseui_apitest ${SOURCE})
-target_link_libraries(browseui_apitest uuid wine)
+target_link_libraries(browseui_apitest uuid wine cpprt)
+
+set_target_cpp_properties(browseui_apitest WITH_EXCEPTIONS WITH_RTTI)
set_module_type(browseui_apitest win32cui)
add_importlibs(browseui_apitest advapi32 shell32 ole32 shlwapi msvcrt kernel32 ntdll)
add_rostests_file(TARGET browseui_apitest)
diff --git a/modules/rostests/apitests/fontext/CMakeLists.txt
b/modules/rostests/apitests/fontext/CMakeLists.txt
index 80654e4d7d5..aca32f42f27 100644
--- a/modules/rostests/apitests/fontext/CMakeLists.txt
+++ b/modules/rostests/apitests/fontext/CMakeLists.txt
@@ -6,7 +6,6 @@ add_definitions(
-D_UNICODE
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl
${CMAKE_CURRENT_BINARY_DIR})
@@ -17,6 +16,6 @@ list(APPEND SOURCE
add_executable(fontext_apitest ${SOURCE})
set_module_type(fontext_apitest win32cui)
-target_link_libraries(fontext_apitest uuid ${PSEH_LIB})
+target_link_libraries(fontext_apitest uuid ${PSEH_LIB} cpprt)
add_importlibs(fontext_apitest oleaut32 ole32 shell32 user32 msvcrt kernel32 ntdll)
add_rostests_file(TARGET fontext_apitest)
diff --git a/modules/rostests/apitests/msgina/CMakeLists.txt
b/modules/rostests/apitests/msgina/CMakeLists.txt
index 0d64a0c2336..9b873773950 100644
--- a/modules/rostests/apitests/msgina/CMakeLists.txt
+++ b/modules/rostests/apitests/msgina/CMakeLists.txt
@@ -2,7 +2,6 @@
add_definitions(
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -10,7 +9,7 @@ add_executable(msgina_apitest
ShellDimScreen.cpp
testlist.c)
-target_link_libraries(msgina_apitest wine uuid)
+target_link_libraries(msgina_apitest wine uuid cpprt)
set_module_type(msgina_apitest win32cui)
add_importlibs(msgina_apitest msvcrt user32 kernel32)
add_rostests_file(TARGET msgina_apitest)
diff --git a/modules/rostests/apitests/ole32/CMakeLists.txt
b/modules/rostests/apitests/ole32/CMakeLists.txt
index 4f6ad2dfdea..d3212869e12 100644
--- a/modules/rostests/apitests/ole32/CMakeLists.txt
+++ b/modules/rostests/apitests/ole32/CMakeLists.txt
@@ -1,7 +1,6 @@
-set_cpp(WITH_RUNTIME)
add_executable(ole32_apitest initializespy.cpp testlist.c)
-target_link_libraries(ole32_apitest wine uuid)
+target_link_libraries(ole32_apitest wine uuid cpprt)
set_module_type(ole32_apitest win32cui)
add_importlibs(ole32_apitest user32 gdi32 shell32 ole32 shlwapi msvcrt kernel32)
add_rostests_file(TARGET ole32_apitest)
diff --git a/modules/rostests/apitests/shell32/CMakeLists.txt
b/modules/rostests/apitests/shell32/CMakeLists.txt
index f719ab6ddab..39c81e5e59e 100644
--- a/modules/rostests/apitests/shell32/CMakeLists.txt
+++ b/modules/rostests/apitests/shell32/CMakeLists.txt
@@ -2,8 +2,6 @@
add_definitions(
-D_ATL_NO_EXCEPTIONS)
-set_cpp(WITH_RUNTIME)
-
spec2def(shell32_apitest.exe shell32_apitest.spec)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
@@ -46,7 +44,7 @@ add_executable(shell32_apitest
resource.rc
${CMAKE_CURRENT_BINARY_DIR}/shell32_apitest.def)
-target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB})
+target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB} cpprt)
set_module_type(shell32_apitest win32cui)
add_importlibs(shell32_apitest user32 gdi32 shell32 ole32 oleaut32 advapi32 shlwapi
msvcrt kernel32 ntdll)
add_pch(shell32_apitest shelltest.h "${PCH_SKIP_SOURCE}")
@@ -54,6 +52,7 @@ add_rostests_file(TARGET shell32_apitest)
# shell-notify.exe
add_executable(shell-notify shell-notify.cpp)
+target_link_libraries(shell-notify cpprt)
set_module_type(shell-notify win32gui UNICODE)
add_importlibs(shell-notify msvcrt kernel32 user32 shell32 shlwapi ole32)
add_rostests_file(TARGET shell-notify SUBDIR testdata)
diff --git a/modules/rostests/apitests/zipfldr/CMakeLists.txt
b/modules/rostests/apitests/zipfldr/CMakeLists.txt
index 63da6889d71..9bda3bd9b2c 100644
--- a/modules/rostests/apitests/zipfldr/CMakeLists.txt
+++ b/modules/rostests/apitests/zipfldr/CMakeLists.txt
@@ -1,7 +1,4 @@
-add_definitions(-DINITGUID -DWINETEST_USE_DBGSTR_LONGLONG)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
-
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
list(APPEND SOURCE
@@ -17,7 +14,8 @@ add_executable(zipfldr_apitest
${PCH_SKIP_SOURCE}
zipfldr_apitest.rc)
-target_link_libraries(zipfldr_apitest wine uuid)
+target_link_libraries(zipfldr_apitest wine uuid cpprt)
+set_target_cpp_properties(zipfldr_apitest WITH_EXCEPTIONS)
set_module_type(zipfldr_apitest win32cui)
add_importlibs(zipfldr_apitest shlwapi ole32 shell32 user32 msvcrt kernel32 ntdll)
add_pch(zipfldr_apitest precomp.h "${PCH_SKIP_SOURCE}")
diff --git a/modules/rostests/rosautotest/CMakeLists.txt
b/modules/rostests/rosautotest/CMakeLists.txt
index 21f0cdd5e23..5d82a954936 100644
--- a/modules/rostests/rosautotest/CMakeLists.txt
+++ b/modules/rostests/rosautotest/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_EXCEPTIONS WITH_STL)
-
list(APPEND SOURCE
CConfiguration.cpp
CFatalException.cpp
@@ -21,6 +19,8 @@ list(APPEND SOURCE
precomp.h)
add_executable(rosautotest ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/rosautotestmsg.rc)
+target_link_libraries(rosautotest cppstl)
+set_target_cpp_properties(rosautotest WITH_EXCEPTIONS)
set_module_type(rosautotest win32cui UNICODE)
add_importlibs(rosautotest advapi32 shell32 user32 wininet msvcrt kernel32 ntdll)
add_pch(rosautotest precomp.h SOURCE)
diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake
index fa408d7d631..707a6b2e524 100644
--- a/sdk/cmake/CMakeMacros.cmake
+++ b/sdk/cmake/CMakeMacros.cmake
@@ -1,86 +1,4 @@
-# set_cpp
-# Marks the current folder as containing C++ modules, additionally enabling
-# specific C++ language features as specified (all of these default to off):
-#
-# WITH_RUNTIME
-# Links with the C++ runtime. Enable this for modules which use new/delete or
-# RTTI, but do not require STL. This is the right choice if you see undefined
-# references to operator new/delete, vector constructor/destructor iterator,
-# type_info::vtable, ...
-# Note: this only affects linking, so cannot be used for static libraries.
-# WITH_RTTI
-# Enables run-time type information. Enable this if the module uses typeid or
-# dynamic_cast. You will probably need to enable WITH_RUNTIME as well, if
-# you're not already using STL.
-# WITH_EXCEPTIONS
-# Enables C++ exception handling. Enable this if the module uses try/catch or
-# throw. You might also need this if you use a standard operator new (the one
-# without nothrow).
-# WITH_STL
-# Enables standard C++ headers and links to the Standard Template Library.
-# Use this for modules using anything from the std:: namespace, e.g. maps,
-# strings, vectors, etc.
-# Note: this affects both compiling (via include directories) and
-# linking (by adding STL). Implies WITH_RUNTIME.
-# FIXME: WITH_STL is currently also required for runtime headers such as
-# <new> and <exception>. This is not a big issue because in
stl-less
-# environments you usually don't want those anyway; but we might want
-# to have modules like this in the future.
-#
-# Examples:
-# set_cpp()
-# Enables the C++ language, but will cause errors if any runtime or standard
-# library features are used. This should be the default for C++ in kernel
-# mode or otherwise restricted environments.
-# Note: this is required to get libgcc (for multiplication/division) linked
-# in for C++ modules, and to set the correct language for precompiled
-# header files, so it IS required even with no features specified.
-# set_cpp(WITH_RUNTIME)
-# Links with the C++ runtime, so that e.g. custom operator new implementations
-# can be used in a restricted environment. This is also required for linking
-# with libraries (such as ATL) which have RTTI enabled, even if the module in
-# question does not use WITH_RTTI.
-# set_cpp(WITH_RTTI WITH_EXCEPTIONS WITH_STL)
-# The full package. This will adjust compiler and linker so that all C++
-# features can be used.
-macro(set_cpp)
- cmake_parse_arguments(__cppopts
"WITH_RUNTIME;WITH_RTTI;WITH_EXCEPTIONS;WITH_STL" "" ""
${ARGN})
- if(__cppopts_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "set_cpp: unparsed arguments
${__cppopts_UNPARSED_ARGUMENTS}")
- endif()
-
- if(__cppopts_WITH_RUNTIME)
- set(CPP_USE_RT 1)
- endif()
- if(__cppopts_WITH_RTTI)
- if(MSVC)
- replace_compile_flags("/GR-" "/GR")
- else()
- replace_compile_flags_language("-fno-rtti" "-frtti"
"CXX")
- endif()
- endif()
- if(__cppopts_WITH_EXCEPTIONS)
- if(MSVC)
- replace_compile_flags("/EHs-c-" "/EHsc")
- else()
- replace_compile_flags_language("-fno-exceptions"
"-fexceptions" "CXX")
- endif()
- endif()
- if(__cppopts_WITH_STL)
- set(CPP_USE_STL 1)
- if(MSVC)
- add_definitions(-DNATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++)
- include_directories(${REACTOS_SOURCE_DIR}/sdk/include/c++/stlport)
- else()
- replace_compile_flags("-nostdinc" " ")
- add_definitions(-DPAL_STDCPP_COMPAT)
- endif()
- endif()
-
- set(IS_CPP 1)
-endmacro()
-
function(add_dependency_node _node)
if(GENERATE_DEPENDENCY_GRAPH)
get_target_property(_type ${_node} TYPE)
@@ -988,3 +906,15 @@ else()
macro(add_pch _target _pch _skip_list)
endmacro()
endif()
+
+function(set_target_cpp_properties _target)
+ cmake_parse_arguments(_CPP "WITH_EXCEPTIONS;WITH_RTTI" ""
"" ${ARGN})
+
+ if (_CPP_WITH_EXCEPTIONS)
+ set_target_properties(${_target} PROPERTIES WITH_CXX_EXCEPTIONS TRUE)
+ endif()
+
+ if (_CPP_WITH_RTTI)
+ set_target_properties(${_target} PROPERTIES WITH_CXX_RTTI TRUE)
+ endif()
+endfunction()
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index 1abe186c702..cf72baeeea4 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -41,8 +41,9 @@ endif()
# Compiler Core
add_compile_flags("-pipe -fms-extensions -fno-strict-aliasing")
-# Prevent GCC from searching any of the default directories
-add_compile_flags("-nostdinc")
+# Prevent GCC from searching any of the default directories.
+# The case for C++ is handled through the reactos_c++ INTERFACE library
+add_compile_options("$<$<NOT:$<COMPILE_LANGUAGE:CXX>>:-nostdinc>")
add_compile_flags("-mstackrealign")
add_compile_flags("-fno-aggressive-loop-optimizations")
@@ -68,8 +69,6 @@ if(DBG)
endif()
endif()
-add_compile_flags_language("-fno-rtti -fno-exceptions" "CXX")
-
#bug
#file(TO_NATIVE_PATH ${REACTOS_SOURCE_DIR} REACTOS_SOURCE_DIR_NATIVE)
#workaround
@@ -292,17 +291,6 @@ function(set_image_base MODULE IMAGE_BASE)
endfunction()
function(set_module_type_toolchain MODULE TYPE)
- if(CPP_USE_STL)
- if((${TYPE} STREQUAL "kernelmodedriver") OR (${TYPE} STREQUAL
"wdmdriver"))
- message(FATAL_ERROR "Use of STL in kernelmodedriver or wdmdriver type
module prohibited")
- endif()
- target_link_libraries(${MODULE} -lstdc++ -lsupc++ -lgcc -lmingwex)
- elseif(CPP_USE_RT)
- target_link_libraries(${MODULE} -lsupc++ -lgcc)
- elseif(IS_CPP)
- target_link_libraries(${MODULE} -lgcc)
- endif()
-
if((${TYPE} STREQUAL "kernelmodedriver") OR (${TYPE} STREQUAL
"wdmdriver"))
add_target_link_flags(${MODULE}
"-Wl,--exclude-all-symbols,-file-alignment=0x1000,-section-alignment=0x1000")
if(${TYPE} STREQUAL "wdmdriver")
@@ -440,3 +428,47 @@ function(add_linker_script _target _linker_script_file)
add_target_link_flags(${_target} "-Wl,-T,${_file_full_path}")
add_target_property(${_target} LINK_DEPENDS ${_file_full_path})
endfunction()
+
+# Manage our C++ options
+# we disable standard includes if we don't use the STL
+add_compile_options("$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<IN_LIST:cppstl,$<TARGET_PROPERTY:LINK_LIBRARIES>>>>:-nostdinc>")
+# we disable RTTI, unless said so
+add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:$<TARGET_PROPERTY:WITH_CXX_RTTI>>,-frtti,-fno-rtti>>")
+# We disable exceptions, unless said so
+add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:$<TARGET_PROPERTY:WITH_CXX_EXCEPTIONS>>,-fexceptions,-fno-exceptions>>")
+
+# Find default G++ libraries
+add_library(libgcc STATIC IMPORTED)
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libgcc.a OUTPUT_VARIABLE
LIBGCC_LOCATION)
+string(STRIP ${LIBGCC_LOCATION} LIBGCC_LOCATION)
+set_target_properties(libgcc PROPERTIES IMPORTED_LOCATION ${LIBGCC_LOCATION})
+# libgcc needs kernel32 imports, a CRT and msvcrtex
+target_link_libraries(libgcc INTERFACE libkernel32 libmsvcrt msvcrtex)
+
+add_library(libsupc++ STATIC IMPORTED GLOBAL)
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libsupc++.a
OUTPUT_VARIABLE LIBSUPCXX_LOCATION)
+string(STRIP ${LIBSUPCXX_LOCATION} LIBSUPCXX_LOCATION)
+set_target_properties(libsupc++ PROPERTIES IMPORTED_LOCATION ${LIBSUPCXX_LOCATION})
+# libsupc++ requires libgcc
+target_link_libraries(libsupc++ INTERFACE libgcc)
+
+add_library(libmingwex STATIC IMPORTED)
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libmingwex.a
OUTPUT_VARIABLE LIBMINGWEX_LOCATION)
+string(STRIP ${LIBMINGWEX_LOCATION} LIBMINGWEX_LOCATION)
+set_target_properties(libmingwex PROPERTIES IMPORTED_LOCATION ${LIBMINGWEX_LOCATION})
+# libmingwex requires a CRT and imports from kernel32
+target_link_libraries(libmingwex INTERFACE libmsvcrt libkernel32)
+
+add_library(libstdc++ STATIC IMPORTED GLOBAL)
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.a
OUTPUT_VARIABLE LIBSTDCCXX_LOCATION)
+string(STRIP ${LIBSTDCCXX_LOCATION} LIBSTDCCXX_LOCATION)
+set_target_properties(libstdc++ PROPERTIES IMPORTED_LOCATION ${LIBSTDCCXX_LOCATION})
+# libstdc++ requires libsupc++ and mingwex provided by GCC
+target_link_libraries(libstdc++ INTERFACE libsupc++ libmingwex)
+# this is for our SAL annotations
+target_compile_definitions(libstdc++ INTERFACE
"$<$<COMPILE_LANGUAGE:CXX>:PAL_STDCPP_COMPAT>")
+
+# Create our alias libraries
+add_library(cppstl ALIAS libstdc++)
+add_library(cpprt ALIAS libsupc++)
+
diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake
index e1899089a6f..3731ca4d500 100644
--- a/sdk/cmake/msvc.cmake
+++ b/sdk/cmake/msvc.cmake
@@ -42,7 +42,7 @@ endif()
# Disable RTTI, exception handling and buffer security checks by default.
# These require run-time support that may not always be available.
-add_compile_flags("/GR- /EHs-c- /GS-")
+add_compile_flags("/GS-")
if(USE_CLANG_CL)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "Note: including file: ")
@@ -252,14 +252,6 @@ function(set_image_base MODULE IMAGE_BASE)
endfunction()
function(set_module_type_toolchain MODULE TYPE)
- if(CPP_USE_STL)
- if((${TYPE} STREQUAL "kernelmodedriver") OR (${TYPE} STREQUAL
"wdmdriver"))
- message(FATAL_ERROR "Use of STL in kernelmodedriver or wdmdriver type
module prohibited")
- endif()
- target_link_libraries(${MODULE} cpprt stlport oldnames)
- elseif(CPP_USE_RT)
- target_link_libraries(${MODULE} cpprt)
- endif()
if((${TYPE} STREQUAL "win32dll") OR (${TYPE} STREQUAL "win32ocx")
OR (${TYPE} STREQUAL "cpl"))
add_target_link_flags(${MODULE} "/DLL")
elseif(${TYPE} STREQUAL "kernelmodedriver")
@@ -559,3 +551,17 @@ function(add_linker_script _target _linker_script_file)
add_target_property(${_target} LINK_DEPENDS ${_file_full_path})
endif()
endfunction()
+
+# handle C++ options
+# disable RTTI unless said so
+add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:$<TARGET_PROPERTY:WITH_CXX_RTTI>>,/GR,/GR->>")
+# disable exceptions unless said so
+add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:$<IF:$<BOOL:$<TARGET_PROPERTY:WITH_CXX_EXCEPTIONS>>,/EHsc,/EHs-c->>")
+
+# Create our interface libraries wrapping the needed library for this compiler
+add_library(cppstl INTERFACE)
+target_link_libraries(cppstl INTERFACE cpprt stlport oldnames)
+# We set this properties through our INTERFACE library
+set_target_properties(cppstl PROPERTIES INTERFACE_WITH_CXX_STL TRUE)
+# add_library(cpprt INTERFACE)
+# Our runtime library is already called cpprt
diff --git a/sdk/lib/3rdparty/cardlib/CMakeLists.txt
b/sdk/lib/3rdparty/cardlib/CMakeLists.txt
index ae2423020eb..1a90575b34b 100644
--- a/sdk/lib/3rdparty/cardlib/CMakeLists.txt
+++ b/sdk/lib/3rdparty/cardlib/CMakeLists.txt
@@ -1,5 +1,4 @@
-set_cpp()
list(APPEND SOURCE
cardbitmaps.cpp
@@ -15,7 +14,9 @@ list(APPEND SOURCE
dropzone.cpp
cardlib.h)
-add_library(cardlib ${SOURCE})
+add_library(cardlib STATIC ${SOURCE})
+target_link_libraries(cardlib PRIVATE cpprt)
+target_include_directories(cardlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(NOT MSVC)
target_compile_options(cardlib PRIVATE "-Wno-unused-but-set-variable")
diff --git a/sdk/lib/3rdparty/stlport/CMakeLists.txt
b/sdk/lib/3rdparty/stlport/CMakeLists.txt
index 865475f8f1b..b2f245bb62f 100644
--- a/sdk/lib/3rdparty/stlport/CMakeLists.txt
+++ b/sdk/lib/3rdparty/stlport/CMakeLists.txt
@@ -2,13 +2,6 @@
#uncomment this if you want to test c++ compilation
#add_subdirectory(test)
-set_cpp(WITH_RTTI WITH_EXCEPTIONS WITH_STL)
-
-add_definitions(
- -D_STLP_USE_EXCEPTIONS
- -D_DLL -D__USE_CRTIMP
- -D_BUILD_STLPORT)
-
list(APPEND SOURCE
src/allocators.cpp
src/bitset.cpp
@@ -53,5 +46,14 @@ if(USE_CLANG_CL)
target_compile_options(stlport PRIVATE -Wno-tautological-unsigned-zero-compare)
endif()
+target_include_directories(stlport PRIVATE
${REACTOS_SOURCE_DIR}/sdk/include/c++/stlport)
+target_compile_definitions(stlport PRIVATE
+ _STLP_USE_EXCEPTIONS _DLL __USE_CRTIMP
+ _BUILD_STLPORT NATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++)
+
+target_include_directories(stlport INTERFACE
"$<$<COMPILE_LANGUAGE:CXX>:${REACTOS_SOURCE_DIR}/sdk/include/c++/stlport>")
+target_compile_definitions(stlport INTERFACE
"$<$<COMPILE_LANGUAGE:CXX>:NATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/sdk/include/c++>")
+set_target_cpp_properties(stlport WITH_EXCEPTIONS WITH_RTTI)
+
add_dependencies(stlport xdk)
add_pch(stlport src/stlport_prefix.h SOURCE)
diff --git a/sdk/lib/comsupp/CMakeLists.txt b/sdk/lib/comsupp/CMakeLists.txt
index 52b78314817..885d09832a9 100644
--- a/sdk/lib/comsupp/CMakeLists.txt
+++ b/sdk/lib/comsupp/CMakeLists.txt
@@ -1,4 +1,6 @@
-set_cpp(WITH_EXCEPTIONS WITH_STL)
add_library(comsupp comsupp.cpp)
+target_link_libraries(comsupp PRIVATE cppstl)
+set_target_cpp_properties(comsupp WITH_EXCEPTIONS)
+
add_dependencies(comsupp psdk)
diff --git a/sdk/lib/cpprt/CMakeLists.txt b/sdk/lib/cpprt/CMakeLists.txt
index de120e40423..7db6f5c1ea4 100644
--- a/sdk/lib/cpprt/CMakeLists.txt
+++ b/sdk/lib/cpprt/CMakeLists.txt
@@ -1,6 +1,4 @@
-set_cpp(WITH_EXCEPTIONS)
-
include_directories(
${REACTOS_SOURCE_DIR}/sdk/lib/crt/include
${REACTOS_SOURCE_DIR}/sdk/include/c++)
@@ -21,4 +19,5 @@ elseif(ARCH STREQUAL "arm")
endif()
add_library(cpprt ${SOURCE} ${cpprt_asm})
+set_target_cpp_properties(cpprt WITH_EXCEPTIONS)
add_dependencies(cpprt xdk)
diff --git a/sdk/lib/drivers/sound/stdunk/CMakeLists.txt
b/sdk/lib/drivers/sound/stdunk/CMakeLists.txt
index b7f8fac0999..5825f84f4f2 100644
--- a/sdk/lib/drivers/sound/stdunk/CMakeLists.txt
+++ b/sdk/lib/drivers/sound/stdunk/CMakeLists.txt
@@ -1,4 +1,3 @@
-set_cpp()
add_library(stdunk cunknown.cpp)
add_dependencies(stdunk xdk)