Skip to content
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

Merged
merged 4 commits into from Jan 8, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/mxe-conf.mk
Expand Up @@ -26,10 +26,10 @@ define $(PKG)_BUILD
touch '$(CMAKE_TOOLCHAIN_DIR)/.gitkeep'
(echo 'set(CMAKE_SYSTEM_NAME Windows)'; \
echo 'set(MSYS 1)'; \
echo 'set(BUILD_SHARED_LIBS $(CMAKE_SHARED_BOOL))'; \
echo 'set(BUILD_STATIC_LIBS $(CMAKE_STATIC_BOOL))'; \
echo 'set(BUILD_SHARED $(CMAKE_SHARED_BOOL))'; \
echo 'set(BUILD_STATIC $(CMAKE_STATIC_BOOL))'; \
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)'; \
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

  1. 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.
  2. There are situations when you need to prepare shared library which is statically linked with third-party libraries.
  3. There are (more rare) situations when you need to compile shared and static versions of your libraries simultaneously.
  4. 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...

echo 'set(LIBTYPE $(if $(BUILD_SHARED),SHARED,STATIC))'; \
echo 'set(CMAKE_PREFIX_PATH $(PREFIX)/$(TARGET))'; \
echo 'set(CMAKE_FIND_ROOT_PATH $(PREFIX)/$(TARGET))'; \
Expand All @@ -42,7 +42,7 @@ define $(PKG)_BUILD
echo 'set(CMAKE_RC_COMPILER $(PREFIX)/bin/$(TARGET)-windres)'; \
echo 'set(CMAKE_MODULE_PATH "$(PREFIX)/share/cmake/modules" $${CMAKE_MODULE_PATH}) # For mxe FindPackage scripts'; \
echo 'set(CMAKE_INSTALL_PREFIX $(PREFIX)/$(TARGET) CACHE PATH "Installation Prefix")'; \
echo 'set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug|Release|RelWithDebInfo|MinSizeRel")'; \
echo 'set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug|Release|RelWithDebInfo|MinSizeRel" FORCE)'; \
echo 'set(CMAKE_CROSS_COMPILING ON) # Workaround for http://www.cmake.org/Bug/view.php?id=14075'; \
echo ''; \
echo 'file(GLOB mxe_cmake_files'; \
Expand Down