From d25fe17b28587e066e80e35dc5d528c22a12dc38 Mon Sep 17 00:00:00 2001 From: Simon Richter Date: Sat, 1 Jan 2022 21:21:49 -0500 Subject: [PATCH] Bump minimum required CMake version to 3.11 Signed-off-by: Marek Roszko --- 3d-viewer/CMakeLists.txt | 18 ++++++------- CMakeLists.txt | 2 +- common/CMakeLists.txt | 27 +++++-------------- eeschema/CMakeLists.txt | 37 +++++++++++++------------ gerbview/CMakeLists.txt | 19 ++++--------- kicad/CMakeLists.txt | 6 ++--- libs/kimath/CMakeLists.txt | 12 +++------ pcbnew/CMakeLists.txt | 40 ++++++++++------------------ pcbnew/plugins/altium/CMakeLists.txt | 13 +++++---- qa/common/CMakeLists.txt | 5 +--- qa/common_tools/CMakeLists.txt | 5 +--- qa/eeschema/CMakeLists.txt | 16 +---------- qa/pcbnew/CMakeLists.txt | 5 +--- 13 files changed, 68 insertions(+), 137 deletions(-) diff --git a/3d-viewer/CMakeLists.txt b/3d-viewer/CMakeLists.txt index a19e4a0860..664065f00a 100644 --- a/3d-viewer/CMakeLists.txt +++ b/3d-viewer/CMakeLists.txt @@ -110,15 +110,13 @@ add_library(3d-viewer STATIC ${3D-VIEWER_SRCS}) add_dependencies( 3d-viewer pcbcommon ) target_link_libraries( 3d-viewer - gal - kimath - ${Boost_LIBRARIES} - ${wxWidgets_LIBRARIES} - ${OPENGL_LIBRARIES} - kicad_3dsg ) - -target_include_directories( 3d-viewer PRIVATE - $ - ) + PRIVATE + gal + kimath + nlohmann_json + ${Boost_LIBRARIES} + ${wxWidgets_LIBRARIES} + ${OPENGL_LIBRARIES} + kicad_3dsg ) add_subdirectory( 3d_cache ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cd76e8db5..3048b5d9ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # -cmake_minimum_required( VERSION 3.10 FATAL_ERROR ) +cmake_minimum_required( VERSION 3.11 FATAL_ERROR ) # Default to CMAKE_BUILD_TYPE = Release unless overridden on command line # http://www.cmake.org/pipermail/cmake/2008-September/023808.html diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index fff8e82218..32e10fb3a9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -67,6 +67,7 @@ add_library( gal STATIC ${GAL_SRCS} ) target_link_libraries( gal common # This is needed until the circular dependency is removed kimath + nlohmann_json ${GLEW_LIBRARIES} ${CAIRO_LIBRARIES} ${PIXMAN_LIBRARIES} @@ -74,10 +75,6 @@ target_link_libraries( gal ${GDI_PLUS_LIBRARIES} ) -target_include_directories( gal PRIVATE - $ - ) - # Only for win32 cross compilation using MXE if( WIN32 AND MSYS ) @@ -477,37 +474,31 @@ set( COMMON_SRCS add_library( common STATIC ${COMMON_SRCS} - $ ) -target_include_directories( common PRIVATE - $ - ) - -add_dependencies( common libcontext ) add_dependencies( common version_header ) add_dependencies( common compoundfilereader ) # used by altium_parser.cpp target_link_libraries( common + libcontext kimath kiplatform gal scripting pybind11::embed + compoundfilereader ${Boost_LIBRARIES} ${CURL_LIBRARIES} ${wxWidgets_LIBRARIES} ${EXTRA_LIBS} ) -target_include_directories( common PUBLIC - $ +target_include_directories( common + PUBLIC + . + ${CMAKE_BINARY_DIR} ) -target_include_directories( common PUBLIC - $ - ) # used by altium_parser.cpp - set( PCB_COMMON_SRCS base_screen.cpp eda_text.cpp @@ -590,10 +581,6 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} ) -target_include_directories( pcbcommon PUBLIC - $ -) - target_link_libraries( pcbcommon PUBLIC common delaunator diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 3b10742688..f6fc135be4 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -22,7 +22,6 @@ endif() include_directories( BEFORE ${INC_BEFORE} ) include_directories( ./dialogs - ./netlist_exporters ./widgets symbol_editor ./libview @@ -385,12 +384,14 @@ add_library( eeschema_kiface_objects OBJECT ${EESCHEMA_COMMON_SRCS} ) -# CMake <3.9 can't link anything to object libraries, -# but we only need include directories, as we will link the kiface MODULE -target_include_directories( eeschema_kiface_objects PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - $ -) +target_include_directories( eeschema_kiface_objects + PUBLIC + . + netlist_exporters ) + +target_link_libraries( eeschema_kiface_objects + PUBLIC + common ) # Since we're not using target_link_libraries, we need to explicitly # declare the dependency @@ -398,25 +399,23 @@ add_dependencies( eeschema_kiface_objects common ) add_library( eeschema_kiface MODULE eeschema.cpp - $ ) -target_include_directories( eeschema_kiface PUBLIC - $ -) - target_link_libraries( eeschema_kiface - common - sexpr - markdown_lib - scripting - ${wxWidgets_LIBRARIES} - ${GDI_PLUS_LIBRARIES} + PRIVATE + eeschema_kiface_objects + common + sexpr + markdown_lib + scripting + ${wxWidgets_LIBRARIES} + ${GDI_PLUS_LIBRARIES} ) if( KICAD_SPICE ) target_link_libraries( eeschema_kiface - ${NGSPICE_LIBRARY} + PRIVATE + ${NGSPICE_LIBRARY} ) endif() diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 9c68ab4c0d..e41408813f 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -134,16 +134,10 @@ add_library( gerbview_kiface_objects OBJECT ${WIDGET_SRCS} ${GERBVIEW_EXTRA_SRCS} ) - -# Since we're not using target_link_libraries, we need to explicitly -# declare the dependency -add_dependencies( gerbview_kiface_objects common ) -add_dependencies( gerbview_kiface_objects gal ) - -# CMake <3.9 can't link anything to object libraries, -# but we only need include directories, as we will link the kiface MODULE -target_include_directories( gerbview_kiface_objects PRIVATE - $ +target_link_libraries( gerbview_kiface_objects + PUBLIC + common + gal ) # the main gerbview program, in DSO form. @@ -154,6 +148,7 @@ set_target_properties( gerbview_kiface PROPERTIES SUFFIX ${KIFACE_SUFFIX} ) target_link_libraries( gerbview_kiface + nlohmann_json gal common ${wxWidgets_LIBRARIES} @@ -169,10 +164,6 @@ if( MAKE_LINK_MAPS ) LINK_FLAGS "-Wl,-cref,-Map=_gerbview.kiface.map" ) endif() -target_include_directories( gerbview_kiface PRIVATE - $ - ) - # if building gerbview, then also build gerbview_kiface if out of date. add_dependencies( gerbview gerbview_kiface ) diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index 04edf80fb3..4e19c4841a 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -66,10 +66,6 @@ add_executable( kicad WIN32 MACOSX_BUNDLE ${KICAD_RESOURCES} ) -target_include_directories( kicad PRIVATE - $ - ) - if( UNIX ) # for build directory: create kiface symlinks so kicad (exe) can be run in-situ add_custom_target( kiface_sym_links @@ -85,11 +81,13 @@ if( APPLE ) MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/kicad/Info.plist ) target_link_libraries( kicad + nlohmann_json common ${wxWidgets_LIBRARIES} ) else() target_link_libraries( kicad + nlohmann_json common gal common #repeated due to a circular dependency between gal and common diff --git a/libs/kimath/CMakeLists.txt b/libs/kimath/CMakeLists.txt index 354295a8d6..e47f2df011 100644 --- a/libs/kimath/CMakeLists.txt +++ b/libs/kimath/CMakeLists.txt @@ -28,15 +28,12 @@ set( KIMATH_SRCS # Include the other smaller math libraries in this one for convenience add_library( kimath STATIC ${KIMATH_SRCS} - $ - $ ) -add_dependencies( kimath clipper ) -add_dependencies( kimath rtree ) -add_dependencies( kimath othermath ) - target_link_libraries( kimath + clipper + othermath + rtree ${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT ${Boost_LIBRARIES} # Because of the OPT types ) @@ -44,9 +41,6 @@ target_link_libraries( kimath target_include_directories( kimath PUBLIC ${PROJECT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include - $ - $ - $ ) # core/optional.h is needed for OPT types diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index b58cc1ecb5..80c4fb5de8 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -617,13 +617,10 @@ target_link_libraries( pcbnew common gal scripting + nlohmann_json ${wxWidgets_LIBRARIES} ) -target_include_directories( pcbnew INTERFACE - $ - ) - if( PCBNEW_LINK_MAPS ) set_target_properties( pcbnew PROPERTIES LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map" ) @@ -648,33 +645,20 @@ make_lexer( # CMake <3.9 can't link anything to object libraries, # but we only need include directories, as we will link the kiface MODULE -target_include_directories( pcbnew_kiface_objects PRIVATE - $ - $ - $ - $ - $ +target_link_libraries( pcbnew_kiface_objects + PRIVATE + common + dxflib_qcad + nanosvg + tinyspline_lib + nlohmann_json ) -# Since we're not using target_link_libraries, we need to explicitly -# declare the dependency -add_dependencies( pcbnew_kiface_objects common ) -add_dependencies( pcbnew_kiface_objects dxflib_qcad ) -add_dependencies( pcbnew_kiface_objects tinyspline_lib ) -add_dependencies( pcbnew_kiface_objects nanosvg ) - if( KICAD_STEP_EXPORT_LIB ) - target_include_directories( pcbnew_kiface_objects PRIVATE - $ - ) - add_dependencies( pcbnew_kiface_objects kicad2step_lib ) - - list( APPEND PCBNEW_EXTRA_LIBS kicad2step_lib ) - add_definitions( -DKICAD_STEP_EXPORT_LIB ) endif() -add_library( pcbnew_kiface MODULE $ ) +add_library( pcbnew_kiface MODULE ) set_target_properties( pcbnew_kiface PROPERTIES # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like @@ -697,6 +681,7 @@ if ( KICAD_BUILD_TESTS ) endif () set( PCBNEW_KIFACE_LIBRARIES + pcbnew_kiface_objects 3d-viewer connectivity pcbcommon @@ -719,7 +704,10 @@ set( PCBNEW_KIFACE_LIBRARIES ) -target_link_libraries( pcbnew_kiface ${PCBNEW_KIFACE_LIBRARIES} ) +target_link_libraries( pcbnew_kiface + PRIVATE + ${PCBNEW_KIFACE_LIBRARIES} + ) set_source_files_properties( pcbnew.cpp PROPERTIES # The KIFACE is in pcbnew.cpp, export it: diff --git a/pcbnew/plugins/altium/CMakeLists.txt b/pcbnew/plugins/altium/CMakeLists.txt index 8181d9d4e0..a89fc05183 100644 --- a/pcbnew/plugins/altium/CMakeLists.txt +++ b/pcbnew/plugins/altium/CMakeLists.txt @@ -12,11 +12,10 @@ set( ALTIUM2PCBNEW_SRCS add_library( altium2pcbnew STATIC ${ALTIUM2PCBNEW_SRCS} ) -add_dependencies( altium2pcbnew compoundfilereader ) +target_link_libraries( altium2pcbnew + pcbcommon + compoundfilereader ) -target_link_libraries( altium2pcbnew pcbcommon ) - -target_include_directories( altium2pcbnew PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - $ - ) \ No newline at end of file +target_include_directories( altium2pcbnew + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/qa/common/CMakeLists.txt b/qa/common/CMakeLists.txt index 1bd79bd3bd..1e0eeeb269 100644 --- a/qa/common/CMakeLists.txt +++ b/qa/common/CMakeLists.txt @@ -56,6 +56,7 @@ set( common_srcs set( common_libs common + libcontext gal qa_utils ${wxWidgets_LIBRARIES} @@ -65,10 +66,6 @@ set( common_libs # Test executable for non-program-specific code add_executable( qa_common ${common_srcs} ) target_link_libraries( qa_common ${common_libs} ) -target_include_directories( qa_common PRIVATE - $ -) - include_directories( ${CMAKE_SOURCE_DIR} diff --git a/qa/common_tools/CMakeLists.txt b/qa/common_tools/CMakeLists.txt index 8789238727..2a27b34122 100644 --- a/qa/common_tools/CMakeLists.txt +++ b/qa/common_tools/CMakeLists.txt @@ -50,6 +50,7 @@ include_directories( target_link_libraries( qa_common_tools common + libcontext gal qa_utils sexpr @@ -61,8 +62,4 @@ target_compile_definitions( qa_common_tools PRIVATE PCBNEW ) -target_include_directories( qa_common_tools PRIVATE - $ -) - kicad_add_utils_executable( qa_common_tools ) diff --git a/qa/eeschema/CMakeLists.txt b/qa/eeschema/CMakeLists.txt index 6ddc16fed6..613d75ece2 100644 --- a/qa/eeschema/CMakeLists.txt +++ b/qa/eeschema/CMakeLists.txt @@ -75,18 +75,10 @@ endif() add_executable( qa_eeschema ${QA_EESCHEMA_SRCS} - - # Older CMakes cannot link OBJECT libraries - # https://cmake.org/pipermail/cmake/2013-November/056263.html - $ ) -# Anytime we link to the kiface_objects, we have to add a dependency on the last object -# to ensure that the generated lexer files are finished being used before the qa runs in a -# multi-threaded build -add_dependencies( qa_eeschema eeschema ) - target_link_libraries( qa_eeschema + eeschema_kiface_objects common pcbcommon scripting @@ -97,12 +89,6 @@ target_link_libraries( qa_eeschema ${Boost_LIBRARIES} ) -target_include_directories( qa_eeschema PUBLIC - # Paths for eeschema lib usage (should really be in eeschema/common - # target_include_directories and made PUBLIC) - $ -) - # Eeschema tests, so pretend to be eeschema (for units, etc) target_compile_definitions( qa_eeschema PUBLIC EESCHEMA diff --git a/qa/pcbnew/CMakeLists.txt b/qa/pcbnew/CMakeLists.txt index f68e0ae2bf..3f8eb6a900 100644 --- a/qa/pcbnew/CMakeLists.txt +++ b/qa/pcbnew/CMakeLists.txt @@ -54,10 +54,6 @@ set( QA_PCBNEW_SRCS add_executable( qa_pcbnew ${QA_PCBNEW_SRCS} - - # Older CMakes cannot link OBJECT libraries - # https://cmake.org/pipermail/cmake/2013-November/056263.html - $ ) # Pcbnew tests, so pretend to be pcbnew (for units, etc) @@ -89,6 +85,7 @@ include_directories( target_link_libraries( qa_pcbnew qa_pcbnew_utils + pcbnew_kiface_objects 3d-viewer connectivity pcbcommon