From 5cea94089a99faac82e95171bde4254f31fecd09 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 10 Nov 2013 20:15:09 +0100 Subject: [PATCH] All: under mingw32+msys: fix an issue when using Cmake version >= 2.8.5 which uses by default a response file. This response file is not expanded under mingw3 2 (mingw/gcc bug?), and the list of include paths, found in this file, is not taken in account. Now, under mingw32+msys, when not cross-compiling, the response file is disabled. Cvpcb, Pcbnew: fix a list of libs which should be added only when cross-compiling: Previously, they were always added, which creates an issue with mingw/msy/ gcc 2.8. Now they are added only when cross-compiling (this issue was noticeable only with msys+mingw version 2.8) --- CMakeLists.txt | 20 ++++++++++++++++++++ cvpcb/CMakeLists.txt | 4 ++-- pcbnew/CMakeLists.txt | 6 +++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index decaefbe36..07d9441b1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,26 @@ if( CMAKE_COMPILER_IS_GNUCXX ) if( MINGW ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" ) + # _UNICODE definition seems needed under mingw/gcc 4.8 + # (Kicad uses unicode, and on Windows, wxWidgets >= 2.9.4 is mandatory + # and uses unicode) + if( GCC_VERSION VERSION_EQUAL 4.8.0 OR GCC_VERSION VERSION_GREATER 4.8.0 ) + add_definitions(-D_UNICODE) + endif() + + # Since version 2.8.5, Cmake uses a response file (.rsp) to + # pass the list of include paths to gcc + # unfortunately, under mingw32+msys, at least with gcc 4.8 and previous, + # this file is not expanded and include paths defined in this file are not taken in account + # this is the case of wxWidgets includes + # Disable this response file for includes ( See Windows-GNU.cmake module ) + if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING ) + # fixme: it is needed only with MSYS+MINGW32? or always under MINGW + if (${CMAKE_SIZEOF_VOID_P} MATCHES 4) + set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0) + endif() + endif() + else() # We build DLL/DSOs from static libraries, so create position independent code # for all cases, since we do not have DLL/DSO specific static libraries. diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 6a3582f484..cc337a40b1 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -110,7 +110,7 @@ target_link_libraries( cvpcb ) # Only for win32 cross compilation using MXE -if(WIN32 AND MSYS) +if( WIN32 AND MSYS AND CMAKE_CROSSCOMPILING ) target_link_libraries(cvpcb opengl32 glu32 @@ -119,7 +119,7 @@ target_link_libraries(cvpcb freetype bz2 ) -endif(WIN32 AND MSYS) +endif() if( BUILD_GITHUB_PLUGIN ) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 3cd6fb14c6..f243ce065f 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -235,7 +235,7 @@ set( PCBNEW_CLASS_SRCS zones_polygons_test_connections.cpp zones_test_and_combine_areas.cpp class_footprint_wizard.cpp - + tools/selection_tool.cpp tools/selection_area.cpp tools/bright_box.cpp @@ -551,7 +551,7 @@ target_link_libraries( pcbnew ) # Only for win32 cross compilation using MXE -if(WIN32 AND MSYS) +if( WIN32 AND MSYS AND CMAKE_CROSSCOMPILING ) target_link_libraries(pcbnew opengl32 glu32 @@ -560,7 +560,7 @@ target_link_libraries(pcbnew freetype bz2 ) -endif(WIN32 AND MSYS) +endif() if( MAKE_LINK_MAPS ) # generate a link map with cross reference