Fix mingw compile error "src/kdeui/kapplication_win.cpp:212:22: error: 'kill' was not declared in this scope"
ClosedPublic

Authored by habacker on Dec 19 2017, 1:36 AM.

Details

Summary

This fixes also similar error with msvc in case openssl development
header has been installed into the same location as KDEWin.

Test Plan

cross compiled with mingw

Diff Detail

Repository
R239 KDELibs4Support
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
habacker created this revision.Dec 19 2017, 1:36 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 19 2017, 1:36 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
habacker requested review of this revision.Dec 19 2017, 1:36 AM

So the if() is needed, the AFTER isn't enough?

I wonder how AFTER works in combination with linking to targets that provide include dirs.

This looks all a bit hackish, but I don't have a better suggestion other than this possible simplification.

So the if() is needed,

yes,

the AFTER isn't enough?

I tried that and it does not help - AFTER|BEFORE affects only the order of directories added with include_directories

I wonder how AFTER works in combination with linking to targets that provide include dirs.

It does not, see the explanations below

  1. includes added by target_include_directories

-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/build/src
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/build/src/KF5KDELibs4Support_autogen/include
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/build/src/../../..
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src/kdecore
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src/kdeui
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src/kio
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src/kssl
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/build/src/kssl
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src/kparts
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/src/solid
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/build/src/..
-I/home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0

  1. includes added by include_directories are added here (the following is from openssl) BEFORE|AFTER only affects the order here -isystem /usr/i686-w64-mingw32/sys-root/mingw/include
  1. includes added by target_link_libraries follows here in the order they are added to the target

-isystem /usr/i686-w64-mingw32/sys-root/mingw/include/qt5
-isystem /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtWidgets
-isystem /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtGui
-isystem /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore
...
-isystem /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtTest

  1. the following comes from the imported kdewin target

-isystem /usr/i686-w64-mingw32/sys-root/mingw/include/mingw
-isystem /usr/i686-w64-mingw32/sys-root/mingw/include

To get the above mentioned list by yourself you can install osc (https://en.opensuse.org/openSUSE:OSC) on a linux machine and run

osc co  home:rhabacker:branches:windows:mingw:win32:KF541/mingw32-kdelibs4support  
cd home:rhabacker:branches:windows:mingw:win32:KF541/mingw32-kdelibs4support
osc build
osc chroot
cd /home/abuild/rpmbuild/BUILD/kdelibs4support-5.41.0/build/src
cat CMakeFiles/KF5KDELibs4Support.dir/includes_CXX.rsp | sed 's, ,\n,g' | less

This looks all a bit hackish,

Not been able to specify include directories in the order the user wants looks to be a cmake limitation and may be fixed there. In KDE4 time this has been solved by using CMAKE_REQUIRED_INCLUDES (see https://cgit.kde.org/kdewin.git/tree/cmake/modules/FindKDEWin.cmake#n76) but this was limited to module based find_package modules I guess.

but I don't have a better suggestion other than this possible simplification.

  1. Someone with win32 api knowledge can remove the kdewin dependencies from kdelibs4support, which required to port kill() and probably other functions to native win32 api - wishlist topic ?
  2. making openssl a config based find_package would solve this specific issue too, but only hides the real cause - the cmake limitation in this area.

BTW: After relooking at the patch I saw that I added an obsolate AFTER - will update the patch

habacker updated this revision to Diff 24158.Dec 20 2017, 11:25 AM
  • removed unrelated AFTER parameter
dfaure accepted this revision.Dec 20 2017, 4:25 PM
This revision is now accepted and ready to land.Dec 20 2017, 4:25 PM
This revision was automatically updated to reflect the committed changes.