Commit Graph

90 Commits

Author SHA1 Message Date
Maarten Bent
9ffe6f5575 CMake: Use correct INSTALL_INTERFACE include directory on Linux
The headers are installed in 'include/wx-3.1/', so also use this in the INSTALL_INTERFACE.
Determine wxINSTALL_INCLUDE_DIR only once and reuse it in install.cmake.
2022-06-18 16:08:35 +02:00
Maarten Bent
efa5cfcaa9 CMake: Prevent double directory separators 2022-06-18 15:37:52 +02:00
Maarten Bent
603c13aaba CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +02:00
Maarten Bent
4fa3b8c276 CMake: Fix the minimum supported version
Change the minimum version to 3.0. Version 2.8.12 has never worked,
because it does not support the VERSION parameter in project().

Replace GREATER_EQUAL comparisons, these are only supported since 3.7.

Move PCH related code to a separate file, and include it after
options.cmake and init.cmake. Because only then the wxBUILD_PRECOMP
variable is fully initialized.

Closes #22312.
2022-04-16 15:35:49 +02:00
Maarten Bent
039f0a924a CMake: Create only one target file
Put the target file in lib/cmake/wxWidgets directory.
2022-04-12 22:08:46 +02:00
Maarten Bent
797df0530d CMake: Fix different identifier warning when building with XCode
Add plist file to the Resource group.
2022-04-12 22:08:46 +02:00
Maarten Bent
681e32f521 CMake: Add IS_MONO option to wx_add_library and wx_set_target_properties
Use this instead of checking for the target name.
2022-04-12 22:08:45 +02:00
Maarten Bent
323e6e8320 CMake: Fix using precompiled headers with Objective-C++ files
Compiling .mm files gives error 'Objective C file was disabled in PCH but is currently enabled'.

Enable the OBJCXX language so the Objective-C++ compiler will be detected and used for .mm files instead of the c++ compiler.
Detect if there are .mm files and enable PCH for them too.

Don't set COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS when cotire is not used.
2022-04-12 22:08:45 +02:00
Maarten Bent
d61c9ee4bf CMake: Apply source groups using a function
This will add source groups to all projects, not only libraries.
And there is no need anymore to include it in every project file.
2022-04-11 23:18:58 +02:00
Maarten Bent
7683219f90 CMake: Remove duplicate and unused defines
Remove unused CMake code to get number of mono source files.
wxUSE_BASE=1 is also defined in wx_set_target_properties.
There seems no reason to define _LIB and DLL_EXPORTS, wx does not use it. They
were probably added because the vcxproj files have them.
2022-04-10 23:44:59 +02:00
Maarten Bent
4999c1c84b CMake: Export WXUSINGDLL for shared builds
Always define WXUSINGDLL for plugins.
2022-04-10 23:41:49 +02:00
Maarten Bent
13a82b3d67 CMake: Fix building tests and sample after making target includes private 2022-04-10 23:41:44 +02:00
Maarten Bent
f00e7ced27 CMake: Fix monolithic build
Don't target net and webview libraries directly, but use the wx_ function that will add it to the mono library when applicable.
2022-04-10 21:00:39 +02:00
Maarten Bent
0125a52376 CMake: Improve handling plugin in wx_set_target_properties
Don't link with toolkit or wx libraries, and set the correct defines.
2022-04-10 21:00:39 +02:00
Maarten Bent
f4367b3fee CMake: Use target_precompile_headers when available
Keep using cotire for CMake versions older than 3.16, or when user specifies wxBUILD_PRECOMP=COTIRE.
The scintilla headers need to be specified for target_precompile_headers to work.
Enable it when the target has at least 2 source files (same as cotire does).
2022-04-10 20:46:56 +02:00
Maarten Bent
614d58bf38 CMake: Set precompiled headers when adding libraries
Combine the three pch related functions into one.
2022-04-10 20:46:56 +02:00
JackBoosY
e2a02d4206 CMake: Export target files 2022-04-10 20:46:56 +02:00
Maarten Bent
affbbce1a3 CMake: Make all target_compile_definitions private
It is only used to build scintilla, no need to expose these definitions to external projects.
2022-04-10 20:46:53 +02:00
Maarten Bent
de495c19a3 CMake: Make all target_include_directories private
There is no need to expose them to external projects.
2022-04-10 20:46:26 +02:00
PB
77d8926126 Simplify Windows application manifests
In section "dependency" use "*" in processorArchitecture instead of specifying
the concrete architecture such as "amd64" or "x86". This allows to have just one
manifest for all architectures instead of having them for all supported architectures
individually differing in just processorArchitecture.
2021-12-17 16:57:45 +01:00
Maarten Bent
4f0d9d3346 CMake: Fix library directory when using MinGW
This was broken in b102afc316 (CMake: Don't include generator expression in
wxPLATFORM_LIB_DIR, 2021-10-17).
And for clarity, always add a '/' after directories.

Closes #19305
2021-10-27 21:27:41 +02:00
Maarten Bent
b102afc316 CMake: Don't include generator expression in wxPLATFORM_LIB_DIR
So wxPLATFORM_LIB_DIR can be used in locations where generator expressions are not supported.
2021-10-17 11:52:30 +02:00
Maarten Bent
6d6567d41c CMake: remove duplicate install for builtin libraries 2021-10-17 11:50:34 +02:00
Maarten Bent
2e12779a21 CMake: update Info.plist variables
Use the same values as in build/bakefiles/mac_bundles.bkl.
Use the correct copyright year for in the Info.plist files.
2021-08-17 22:33:45 +02:00
Maarten Bent
4862cbd4c6 CMake: Allow to specify specific Info.plist.in file for samples 2021-08-17 21:50:48 +02:00
Vadim Zeitlin
d7e102f766 Reuse Info.plist used by configure for CMake too
The CMake-specific file is almost identical to the file used by
configure now, so don't keep both of them when just one could do.
2021-08-15 18:39:34 +02:00
Vadim Zeitlin
b7f2e4d423 Fix apparent typo in MACOSX_BUNDLE_BUNDLE_VERSION variable name
The documented name of the bundle version variable has BUNDLE twice, see

https://cmake.org/cmake/help/latest/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html

and samples/Info.plist.in uses this variable, but we set
MACOSX_BUNDLE_VERSION instead, which seems wrong, so use the apparently
correct variable name instead.
2021-08-15 16:56:24 +02:00
jolz
5a514afd34 Remove dependency on GTK from wxbase in CMake build
libwx_baseu_3.1.so should not include "-lgtk-3" during link.

See https://github.com/wxWidgets/wxWidgets/pull/2434

Closes #19224.
2021-07-24 19:19:03 +02:00
Maarten Bent
7828975bb3 CMake: Never use lib prefix for msvc
Fixes regression introduced in f830bde25b (CMake: Improve library names,
2021-05-24)

Closes https://github.com/wxWidgets/wxWidgets/pull/2411
2021-07-03 14:33:07 +01:00
Maarten Bent
980bba88aa CMake: Use .a suffix for import libraries
So it will have the same extension as the libraries created by makefile.gcc.
2021-06-17 23:16:03 +02:00
Maarten Bent
3e0057757b CMake: Use a macro to get the flavour
Also include the flavour in builtin target names and include path.
2021-06-06 23:38:38 +02:00
Maarten Bent
91884752c1 CMake: Create symlinks with so version 2021-06-06 23:36:59 +02:00
Maarten Bent
f830bde25b CMake: Improve library names
Use the same output names as MSVC and makefile.gcc/vc on Windows, and the same as configure on other platforms.
2021-06-06 23:36:59 +02:00
cnbatch
94b399418c Fix an issue that MSVC 2019 cannot compile with CMake
Fix using PCH with MSVC too, which notably fixes using it with vcpkg.

Closes https://github.com/wxWidgets/wxWidgets/pull/2372

Co-Authored-By: Maarten Bent <MaartenBent@users.noreply.github.com>
2021-05-19 19:48:04 +02:00
Vadim Zeitlin
1dfc18a004 Link with ws2_32.lib rather than obsolete wsock32.lib
Winsock 2 provided by ws2_32.lib is available since 1994, it should be
fine to use it even for wx in 2021.

See #15562.
2021-04-18 22:13:45 +02:00
Maarten Bent
c968e49b13 CMake: Remove iOS workaround
Not needed anymore since the fix in 60c620c28c.

Closes https://github.com/wxWidgets/wxWidgets/pull/2308
2021-04-06 11:41:06 +02:00
tamasmeszaros
60c620c28c Fix libraries names when cross compiling on Linux using CMake
This allows using wxWidgets libraries from CMake when cross-compiling
too.

Closes https://github.com/wxWidgets/wxWidgets/pull/2291
2021-04-04 17:06:45 +02:00
Tobias Taschner
c69193d3da
CMake: enable more warnings for GCC/Clang
Enable the same warnings for GCC and Clang as are
enabled with a configure build
2021-03-17 12:58:17 +01:00
Maarten Bent
9585e08365 CMake: Add benchmarks
Put each benchmark application in a sub-directory instead of specifying all in one
file, because cotire cannot create PCH targets for the same file twice (bench.cpp).
2021-02-07 20:34:42 +01:00
Maarten Bent
7b79423470 CMake: Add argument to specify console app that uses gui libraries 2021-02-07 20:11:56 +01:00
Maarten Bent
6dfb96c075 CMake: Use build directory as ctest working directory
Use existing variable for VS working directory.
2021-01-19 19:58:46 +01:00
Maarten Bent
226a3de596 CMake: Use common function for adding samples, tests and demos 2021-01-19 19:58:46 +01:00
Maarten Bent
4ee04daa7c Enable position independent code by default
Add a build option (--disable-pic, wxBUILD_PIC=OFF) to disable it.

Note that it is always enabled for shared libraries and static third party libraries.
2020-08-06 21:43:41 +02:00
Maarten Bent
3328480f78 CMake: use set_target_properties() instead of set_property(TARGET ) 2020-08-03 21:35:13 +02:00
Stefan Csomor
dedefa65c1 applying CMake patch from @MaartenBent 2020-07-05 15:54:27 +02:00
Maarten Bent
ba3fd12efb CMake: fix linking the DLL sample in monolithic build 2020-05-17 20:01:03 +02:00
Maarten Bent
0f806ad96d CMake: use wx prefix in library names
Rename all library targets to start with wx. This way it does not use generic
names like base or core that could interfere with other libraries that add
include the wxWidgets project.
2020-05-17 20:01:02 +02:00
Maarten Bent
0c2d05f52f CMake: add library aliases using wx:: namespace 2020-05-17 20:01:02 +02:00
Maarten Bent
498b79d619 CMake: copy data of widgets sample to correct directory 2020-05-17 20:01:02 +02:00
Maarten Bent
04d82e24cd CMake: enable -Wall for builds using clang or gcc 2020-04-27 00:33:01 +02:00