New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup of cmake based projects #1621
Conversation
Quotes are not needed. Because $(TARGET) is not a path. |
This is a good point. Do we expect new targets with space in name? |
We quote even |
Currently it fails to build. All vars are
|
The problem seems to be introduced by changes in Makefile in 48b3bdb
so it should work, but it doesn't. Anyway this change is out of scope of this pull request (cleanup of cmake based projects), so I removed it. |
Now it fails, because
|
Now pcl fails. From toolchain file:
I will try to add |
Native binaries (libmysqlclient, vtk, vtk6) still build with `cmake` instead of the cmake wrapper. Note that even in these cases MXE's cmake is used (not system cmake), because $(PREFIX)/$(BUILD)/bin is added to PATH by Makefile and MXE's cmake binary exists there.
Only BUILD_SHARED_LIBS was there before.
Now it builds correctly. Lists of files produced by all packages are the same. |
The variables need an extra
See references to |
I tried to use double |
I see, the function needs to be deferred also: @@ -564,8 +564,8 @@ build-only-$(1)_$(3): TEST_FILE = $($(1)_TEST_FILE)
build-only-$(1)_$(3): CMAKE_RUNRESULT_FILE = $(PREFIX)/share/cmake/modules/TryRunResults.cmake
build-only-$(1)_$(3): CMAKE_TOOLCHAIN_FILE = $(PREFIX)/$(3)/share/cmake/mxe-conf.cmake
build-only-$(1)_$(3): CMAKE_TOOLCHAIN_DIR = $(PREFIX)/$(3)/share/cmake/mxe-conf.d
-build-only-$(1)_$(3): CMAKE_STATIC_BOOL = $(if $(findstring shared,$(3)),OFF,ON)
-build-only-$(1)_$(3): CMAKE_SHARED_BOOL = $(if $(findstring shared,$(3)),ON,OFF)
+build-only-$(1)_$(3): CMAKE_STATIC_BOOL = $$(if $$(BUILD_STATIC),ON,OFF)
+build-only-$(1)_$(3): CMAKE_SHARED_BOOL = $$(if $$(BUILD_SHARED),ON,OFF)
build-only-$(1)_$(3):
$(if $(value $(call LOOKUP_PKG_RULE,$(1),BUILD,$(3))),
uname -a |
src/mxe-conf.mk
Outdated
echo 'set(BUILD_SHARED_LIBS $(CMAKE_SHARED_BOOL) CACHE BOOL "BUILD_SHARED_LIBS" FORCE)'; \ | ||
echo 'set(BUILD_STATIC_LIBS $(CMAKE_STATIC_BOOL) CACHE BOOL "BUILD_STATIC_LIBS" FORCE)'; \ | ||
echo 'set(BUILD_SHARED $(CMAKE_SHARED_BOOL) CACHE BOOL "BUILD_SHARED" FORCE)'; \ | ||
echo 'set(BUILD_STATIC $(CMAKE_STATIC_BOOL) CACHE BOOL "BUILD_STATIC" FORCE)'; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behaviour simplifies building MXE itself but complicates its usage for developing of own libraries by end users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on this, please? Do you need to redefine BUILD_SHARED_LIBS in a CMakeLists.txt of a library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on this, please?
Yes, sure.
- There are situations when you need to prepare static library for internal usage in your project despite the fact that all third-party libraries are shared ones.
- There are situations when you need to prepare shared library which is statically linked with third-party libraries.
- There are (more rare) situations when you need to compile shared and static versions of your libraries simultaneously.
- BUILD_SHARED_LIBS and BUILD_STATIC_LIBS options are commonly used for switching between different types of build. From my personal experience situations when specific options (like FREEGLUT_BUILD_STATIC_LIBS and FREEGLUT_BUILD_SHARED_LIBS) are used for this purpose are very rare.
So forcing one type of build in cmake config may be inconvenient for end users. But of course they may fix it themself...
Use CMake wrapper in all but native packages.
Delete cmake arguments specifying build type (static, shared).
Move some of common cmake variables to the toolchain file.
Refactor definitions of some variables (less repeats, more code reusing).