← Back to team overview

kicad-developers team mailing list archive

Fix CMakeLists.txt

 

Hi!

While trying to build KiCad for Fedora 28 I discovered some minor problems in the main CMakeLists.txt file. Patches attached.

Best regards,
Marcus
>From cbb85acdd95a6b4f91a8369f405a5ff841a424cf Mon Sep 17 00:00:00 2001
From: Marcus A <aimylios@xxxxxx>
Date: Sat, 21 Jul 2018 08:10:24 +0200
Subject: [PATCH 1/3] Update description of build options

Commit 93683d0021c4f592f929e9785abeda9d169ba03b changed the default build
options but did not update their description.
---
 CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2ea761f9..54f235a72 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@ option( USE_WX_OVERLAY
     "Use wxOverlay: Always ON for MAC (default OFF).  Warning, this is experimental" )
 
 option( KICAD_SCRIPTING
-    "Build the Python scripting support inside KiCad binaries (default OFF)."
+    "Build the Python scripting support inside KiCad binaries (default ON)."
     ON )
 
 option( KICAD_SCRIPTING_MODULES
@@ -68,7 +68,7 @@ option( KICAD_SCRIPTING_MODULES
     ON )
 
 option( KICAD_SCRIPTING_WXPYTHON
-    "Build wxPython implementation for wx interface building in Python and py.shell (default OFF)."
+    "Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
     ON )
 
 option( KICAD_SCRIPTING_ACTION_MENU
-- 
2.17.1

>From 14a749c7a2e2832416a5a5008b992c3f6568393a Mon Sep 17 00:00:00 2001
From: Marcus A <aimylios@xxxxxx>
Date: Sat, 21 Jul 2018 10:53:07 +0200
Subject: [PATCH 2/3] Fix some typos in CMakeLists.txt

---
 CMakeLists.txt | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54f235a72..b8cee3cdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,7 +72,7 @@ option( KICAD_SCRIPTING_WXPYTHON
     ON )
 
 option( KICAD_SCRIPTING_ACTION_MENU
-    "Build a tools menu with registred python plugins: actions plugins (default OFF)."
+    "Build a tools menu with registered python plugins: actions plugins (default OFF)."
     )
 
 option( KICAD_USE_OCE
@@ -84,14 +84,14 @@ option( KICAD_USE_OCC
     OFF )
 
 option( KICAD_INSTALL_DEMOS
-    "Install kicad demos and examples (default ON)"
+    "Install KiCad demos and examples (default ON)"
     ON )
 
 # when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
 # PYTHON_EXECUTABLE can be defined when invoking cmake
 # ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
 # when not defined by user, the default is python.exe under Windows and python2 for others
-# python binary file should be is exec path.
+# python binary file should be in exec path.
 
 # KICAD_SCRIPTING_MODULES requires KICAD_SCRIPTING enable it here if KICAD_SCRIPTING_MODULES is ON
 if ( KICAD_SCRIPTING_MODULES AND NOT KICAD_SCRIPTING )
@@ -107,7 +107,7 @@ endif()
 
 option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
 
-option( KICAD_SPICE "Build Kicad with internal Spice simulator." ON )
+option( KICAD_SPICE "Build KiCad with internal Spice simulator." ON )
 
 # Global setting: exports are explicit
 set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
@@ -163,7 +163,7 @@ if( NOT DEFAULT_INSTALL_PATH )
          "Location of KiCad data files." )
 endif()
 
-message( STATUS "Kicad install dir: <${DEFAULT_INSTALL_PATH}>" )
+message( STATUS "KiCad install dir: <${DEFAULT_INSTALL_PATH}>" )
 
 # Generate build system specific header file.
 include( PerformFeatureChecks )
@@ -204,7 +204,7 @@ endif()
 # Unfortunately, the swig autogenerated files have a lot of shadowed variables
 # and -Wno-shadow does not exist.
 # Adding -Wshadow can be made only for .cpp files
-#and will be added later in CMakeLists.txt
+# and will be added later in CMakeLists.txt
 if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
     include(CheckCXXCompilerFlag)
 
@@ -281,7 +281,7 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
         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
+        # (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)
-- 
2.17.1

>From 74db48d6c46f6469bf8d52f9bd77c7dfafe13d44 Mon Sep 17 00:00:00 2001
From: Marcus A <aimylios@xxxxxx>
Date: Sat, 21 Jul 2018 11:12:46 +0200
Subject: [PATCH 3/3] Fix detection of wxWidgets toolkit

wxWidgets_CONFIG_OPTIONS can be utilised to explicitly select GTK2 or GTK3. It
must be evaluated when querying the toolkit to avoid a mismatch between the
version actually used and the version KiCad assumes to be used.
---
 CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8cee3cdb..a41740b49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -555,7 +555,7 @@ endif()
 # Turn on wxWidgets compatibility mode for some classes
 add_definitions( -DWX_COMPATIBILITY )
 
-# See line 41 of CMakeModules/FindwxWidgets.cmake
+# See line 49 of CMakeModules/FindwxWidgets.cmake
 set( wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --static=no )
 
 find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
@@ -564,7 +564,9 @@ find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc R
 include( ${wxWidgets_USE_FILE} )
 
 # Check the toolkit used to build wxWidgets
-execute_process( COMMAND sh -c "${wxWidgets_CONFIG_EXECUTABLE} --query-toolkit"
+execute_process(
+    COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
+        ${wxWidgets_CONFIG_OPTIONS} --query-toolkit
     RESULT_VARIABLE wxWidgets_TOOLKIT_RESULT
     OUTPUT_VARIABLE wxWidgets_TOOLKIT_FOUND
     OUTPUT_STRIP_TRAILING_WHITESPACE
-- 
2.17.1


Follow ups