Skip to content

Commit

Permalink
workaround for a weird behaviour of Shiboken2Config.cmake that may ex…
Browse files Browse the repository at this point in the history
…plicitly set CMAKE_BUILD_TYPE to Release
  • Loading branch information
wwmayer committed Jul 31, 2019
1 parent 9e203dd commit cc59222
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Expand Up @@ -1043,7 +1043,12 @@ if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")
endif(DEFINED MACPORTS_PREFIX)

# Shiboken2Config.cmake may explicitly set CMAKE_BUILD_TYPE to Release which causes
# CMake to fail to create Makefiles for a debug build.
# So as a workaround we save and restore the value after checking for Shiboken2.
set (SAVE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
find_package(Shiboken2 QUIET)# REQUIRED
set (CMAKE_BUILD_TYPE ${SAVE_BUILD_TYPE})
if (Shiboken2_FOUND)
# Shiboken2 config file was found but it may use the wrong Python version
# Try to get the matching config suffix and repeat finding the package
Expand Down Expand Up @@ -1229,7 +1234,6 @@ if(MSVC)
else(MSVC)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG")
#message(STATUS "DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif(MSVC)

if(MINGW)
Expand Down Expand Up @@ -1282,6 +1286,9 @@ endif(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
message(STATUS "\n==============\n"
"Summary report\n"
"==============\n")
if (DEFINED CMAKE_BUILD_TYPE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif()

# Qt5 needs/sets PYTHON_CONFIG_SUFFIX regarding Shiboken
message(STATUS "Python: [${PYTHON_EXECUTABLE}] [${PYTHON_CONFIG_SUFFIX}]")
Expand Down

0 comments on commit cc59222

Please sign in to comment.