Bump minimum required CMake version to 3.11

Signed-off-by: Marek Roszko <mark.roszko@gmail.com>
This commit is contained in:
Simon Richter 2022-01-01 21:21:49 -05:00 committed by Marek Roszko
parent 7d671cff1e
commit d25fe17b28
13 changed files with 68 additions and 137 deletions

View File

@ -110,15 +110,13 @@ add_library(3d-viewer STATIC ${3D-VIEWER_SRCS})
add_dependencies( 3d-viewer pcbcommon ) add_dependencies( 3d-viewer pcbcommon )
target_link_libraries( 3d-viewer target_link_libraries( 3d-viewer
PRIVATE
gal gal
kimath kimath
nlohmann_json
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
kicad_3dsg ) kicad_3dsg )
target_include_directories( 3d-viewer PRIVATE
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
)
add_subdirectory( 3d_cache ) add_subdirectory( 3d_cache )

View File

@ -21,7 +21,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # 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 # Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html # http://www.cmake.org/pipermail/cmake/2008-September/023808.html

View File

@ -67,6 +67,7 @@ add_library( gal STATIC ${GAL_SRCS} )
target_link_libraries( gal target_link_libraries( gal
common # This is needed until the circular dependency is removed common # This is needed until the circular dependency is removed
kimath kimath
nlohmann_json
${GLEW_LIBRARIES} ${GLEW_LIBRARIES}
${CAIRO_LIBRARIES} ${CAIRO_LIBRARIES}
${PIXMAN_LIBRARIES} ${PIXMAN_LIBRARIES}
@ -74,10 +75,6 @@ target_link_libraries( gal
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
) )
target_include_directories( gal PRIVATE
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
)
# Only for win32 cross compilation using MXE # Only for win32 cross compilation using MXE
if( WIN32 AND MSYS ) if( WIN32 AND MSYS )
@ -477,37 +474,31 @@ set( COMMON_SRCS
add_library( common STATIC add_library( common STATIC
${COMMON_SRCS} ${COMMON_SRCS}
$<TARGET_OBJECTS:libcontext>
) )
target_include_directories( common PRIVATE
$<TARGET_PROPERTY:libcontext,INTERFACE_INCLUDE_DIRECTORIES>
)
add_dependencies( common libcontext )
add_dependencies( common version_header ) add_dependencies( common version_header )
add_dependencies( common compoundfilereader ) # used by altium_parser.cpp add_dependencies( common compoundfilereader ) # used by altium_parser.cpp
target_link_libraries( common target_link_libraries( common
libcontext
kimath kimath
kiplatform kiplatform
gal gal
scripting scripting
pybind11::embed pybind11::embed
compoundfilereader
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${CURL_LIBRARIES} ${CURL_LIBRARIES}
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${EXTRA_LIBS} ${EXTRA_LIBS}
) )
target_include_directories( common PUBLIC target_include_directories( common
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES> PUBLIC
.
${CMAKE_BINARY_DIR}
) )
target_include_directories( common PUBLIC
$<TARGET_PROPERTY:compoundfilereader,INTERFACE_INCLUDE_DIRECTORIES>
) # used by altium_parser.cpp
set( PCB_COMMON_SRCS set( PCB_COMMON_SRCS
base_screen.cpp base_screen.cpp
eda_text.cpp eda_text.cpp
@ -590,10 +581,6 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} ) add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} )
target_include_directories( pcbcommon PUBLIC
$<TARGET_PROPERTY:delaunator,INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries( pcbcommon PUBLIC target_link_libraries( pcbcommon PUBLIC
common common
delaunator delaunator

View File

@ -22,7 +22,6 @@ endif()
include_directories( BEFORE ${INC_BEFORE} ) include_directories( BEFORE ${INC_BEFORE} )
include_directories( include_directories(
./dialogs ./dialogs
./netlist_exporters
./widgets ./widgets
symbol_editor symbol_editor
./libview ./libview
@ -385,12 +384,14 @@ add_library( eeschema_kiface_objects OBJECT
${EESCHEMA_COMMON_SRCS} ${EESCHEMA_COMMON_SRCS}
) )
# CMake <3.9 can't link anything to object libraries, target_include_directories( eeschema_kiface_objects
# but we only need include directories, as we will link the kiface MODULE PUBLIC
target_include_directories( eeschema_kiface_objects PUBLIC .
${CMAKE_CURRENT_SOURCE_DIR} netlist_exporters )
$<TARGET_PROPERTY:common,INTERFACE_INCLUDE_DIRECTORIES>
) target_link_libraries( eeschema_kiface_objects
PUBLIC
common )
# Since we're not using target_link_libraries, we need to explicitly # Since we're not using target_link_libraries, we need to explicitly
# declare the dependency # declare the dependency
@ -398,14 +399,11 @@ add_dependencies( eeschema_kiface_objects common )
add_library( eeschema_kiface MODULE add_library( eeschema_kiface MODULE
eeschema.cpp eeschema.cpp
$<TARGET_OBJECTS:eeschema_kiface_objects>
) )
target_include_directories( eeschema_kiface PUBLIC
$<TARGET_PROPERTY:eeschema_kiface_objects,INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries( eeschema_kiface target_link_libraries( eeschema_kiface
PRIVATE
eeschema_kiface_objects
common common
sexpr sexpr
markdown_lib markdown_lib
@ -416,6 +414,7 @@ target_link_libraries( eeschema_kiface
if( KICAD_SPICE ) if( KICAD_SPICE )
target_link_libraries( eeschema_kiface target_link_libraries( eeschema_kiface
PRIVATE
${NGSPICE_LIBRARY} ${NGSPICE_LIBRARY}
) )
endif() endif()

View File

@ -134,16 +134,10 @@ add_library( gerbview_kiface_objects OBJECT
${WIDGET_SRCS} ${WIDGET_SRCS}
${GERBVIEW_EXTRA_SRCS} ${GERBVIEW_EXTRA_SRCS}
) )
target_link_libraries( gerbview_kiface_objects
# Since we're not using target_link_libraries, we need to explicitly PUBLIC
# declare the dependency common
add_dependencies( gerbview_kiface_objects common ) gal
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_PROPERTY:common,INTERFACE_INCLUDE_DIRECTORIES>
) )
# the main gerbview program, in DSO form. # the main gerbview program, in DSO form.
@ -154,6 +148,7 @@ set_target_properties( gerbview_kiface PROPERTIES
SUFFIX ${KIFACE_SUFFIX} SUFFIX ${KIFACE_SUFFIX}
) )
target_link_libraries( gerbview_kiface target_link_libraries( gerbview_kiface
nlohmann_json
gal gal
common common
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
@ -169,10 +164,6 @@ if( MAKE_LINK_MAPS )
LINK_FLAGS "-Wl,-cref,-Map=_gerbview.kiface.map" ) LINK_FLAGS "-Wl,-cref,-Map=_gerbview.kiface.map" )
endif() endif()
target_include_directories( gerbview_kiface PRIVATE
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
)
# if building gerbview, then also build gerbview_kiface if out of date. # if building gerbview, then also build gerbview_kiface if out of date.
add_dependencies( gerbview gerbview_kiface ) add_dependencies( gerbview gerbview_kiface )

View File

@ -66,10 +66,6 @@ add_executable( kicad WIN32 MACOSX_BUNDLE
${KICAD_RESOURCES} ${KICAD_RESOURCES}
) )
target_include_directories( kicad PRIVATE
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
)
if( UNIX ) if( UNIX )
# for build directory: create kiface symlinks so kicad (exe) can be run in-situ # for build directory: create kiface symlinks so kicad (exe) can be run in-situ
add_custom_target( kiface_sym_links add_custom_target( kiface_sym_links
@ -85,11 +81,13 @@ if( APPLE )
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/kicad/Info.plist MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/kicad/Info.plist
) )
target_link_libraries( kicad target_link_libraries( kicad
nlohmann_json
common common
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )
else() else()
target_link_libraries( kicad target_link_libraries( kicad
nlohmann_json
common common
gal gal
common #repeated due to a circular dependency between gal and common common #repeated due to a circular dependency between gal and common

View File

@ -28,15 +28,12 @@ set( KIMATH_SRCS
# Include the other smaller math libraries in this one for convenience # Include the other smaller math libraries in this one for convenience
add_library( kimath STATIC add_library( kimath STATIC
${KIMATH_SRCS} ${KIMATH_SRCS}
$<TARGET_OBJECTS:clipper>
$<TARGET_OBJECTS:othermath>
) )
add_dependencies( kimath clipper )
add_dependencies( kimath rtree )
add_dependencies( kimath othermath )
target_link_libraries( kimath target_link_libraries( kimath
clipper
othermath
rtree
${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT ${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT
${Boost_LIBRARIES} # Because of the OPT types ${Boost_LIBRARIES} # Because of the OPT types
) )
@ -44,9 +41,6 @@ target_link_libraries( kimath
target_include_directories( kimath PUBLIC target_include_directories( kimath PUBLIC
${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include
$<TARGET_PROPERTY:clipper,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:othermath,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:rtree,INTERFACE_INCLUDE_DIRECTORIES>
) )
# core/optional.h is needed for OPT types # core/optional.h is needed for OPT types

View File

@ -617,13 +617,10 @@ target_link_libraries( pcbnew
common common
gal gal
scripting scripting
nlohmann_json
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )
target_include_directories( pcbnew INTERFACE
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
)
if( PCBNEW_LINK_MAPS ) if( PCBNEW_LINK_MAPS )
set_target_properties( pcbnew PROPERTIES set_target_properties( pcbnew PROPERTIES
LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map" ) LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map" )
@ -648,33 +645,20 @@ make_lexer(
# CMake <3.9 can't link anything to object libraries, # CMake <3.9 can't link anything to object libraries,
# but we only need include directories, as we will link the kiface MODULE # 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
$<TARGET_PROPERTY:common,INTERFACE_INCLUDE_DIRECTORIES> PRIVATE
$<TARGET_PROPERTY:dxflib_qcad,INTERFACE_INCLUDE_DIRECTORIES> common
$<TARGET_PROPERTY:nanosvg,INTERFACE_INCLUDE_DIRECTORIES> dxflib_qcad
$<TARGET_PROPERTY:tinyspline_lib,INTERFACE_INCLUDE_DIRECTORIES> nanosvg
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES> 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 ) if( KICAD_STEP_EXPORT_LIB )
target_include_directories( pcbnew_kiface_objects PRIVATE
$<TARGET_PROPERTY:kicad2step_lib,INTERFACE_INCLUDE_DIRECTORIES>
)
add_dependencies( pcbnew_kiface_objects kicad2step_lib )
list( APPEND PCBNEW_EXTRA_LIBS kicad2step_lib )
add_definitions( -DKICAD_STEP_EXPORT_LIB ) add_definitions( -DKICAD_STEP_EXPORT_LIB )
endif() endif()
add_library( pcbnew_kiface MODULE $<TARGET_OBJECTS:pcbnew_kiface_objects> ) add_library( pcbnew_kiface MODULE )
set_target_properties( pcbnew_kiface PROPERTIES set_target_properties( pcbnew_kiface PROPERTIES
# Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like # Decorate OUTPUT_NAME with PREFIX and SUFFIX, creating something like
@ -697,6 +681,7 @@ if ( KICAD_BUILD_TESTS )
endif () endif ()
set( PCBNEW_KIFACE_LIBRARIES set( PCBNEW_KIFACE_LIBRARIES
pcbnew_kiface_objects
3d-viewer 3d-viewer
connectivity connectivity
pcbcommon 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 set_source_files_properties( pcbnew.cpp PROPERTIES
# The KIFACE is in pcbnew.cpp, export it: # The KIFACE is in pcbnew.cpp, export it:

View File

@ -12,11 +12,10 @@ set( ALTIUM2PCBNEW_SRCS
add_library( altium2pcbnew STATIC ${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
target_include_directories( altium2pcbnew PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
${CMAKE_CURRENT_SOURCE_DIR}
$<TARGET_PROPERTY:compoundfilereader,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@ -56,6 +56,7 @@ set( common_srcs
set( common_libs set( common_libs
common common
libcontext
gal gal
qa_utils qa_utils
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
@ -65,10 +66,6 @@ set( common_libs
# Test executable for non-program-specific code # Test executable for non-program-specific code
add_executable( qa_common ${common_srcs} ) add_executable( qa_common ${common_srcs} )
target_link_libraries( qa_common ${common_libs} ) target_link_libraries( qa_common ${common_libs} )
target_include_directories( qa_common PRIVATE
$<TARGET_PROPERTY:libcontext,INTERFACE_INCLUDE_DIRECTORIES>
)
include_directories( include_directories(
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}

View File

@ -50,6 +50,7 @@ include_directories(
target_link_libraries( qa_common_tools target_link_libraries( qa_common_tools
common common
libcontext
gal gal
qa_utils qa_utils
sexpr sexpr
@ -61,8 +62,4 @@ target_compile_definitions( qa_common_tools
PRIVATE PCBNEW PRIVATE PCBNEW
) )
target_include_directories( qa_common_tools PRIVATE
$<TARGET_PROPERTY:libcontext,INTERFACE_INCLUDE_DIRECTORIES>
)
kicad_add_utils_executable( qa_common_tools ) kicad_add_utils_executable( qa_common_tools )

View File

@ -75,18 +75,10 @@ endif()
add_executable( qa_eeschema add_executable( qa_eeschema
${QA_EESCHEMA_SRCS} ${QA_EESCHEMA_SRCS}
# Older CMakes cannot link OBJECT libraries
# https://cmake.org/pipermail/cmake/2013-November/056263.html
$<TARGET_OBJECTS:eeschema_kiface_objects>
) )
# 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 target_link_libraries( qa_eeschema
eeschema_kiface_objects
common common
pcbcommon pcbcommon
scripting scripting
@ -97,12 +89,6 @@ target_link_libraries( qa_eeschema
${Boost_LIBRARIES} ${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)
$<TARGET_PROPERTY:eeschema_kiface_objects,INCLUDE_DIRECTORIES>
)
# Eeschema tests, so pretend to be eeschema (for units, etc) # Eeschema tests, so pretend to be eeschema (for units, etc)
target_compile_definitions( qa_eeschema target_compile_definitions( qa_eeschema
PUBLIC EESCHEMA PUBLIC EESCHEMA

View File

@ -54,10 +54,6 @@ set( QA_PCBNEW_SRCS
add_executable( qa_pcbnew add_executable( qa_pcbnew
${QA_PCBNEW_SRCS} ${QA_PCBNEW_SRCS}
# Older CMakes cannot link OBJECT libraries
# https://cmake.org/pipermail/cmake/2013-November/056263.html
$<TARGET_OBJECTS:pcbnew_kiface_objects>
) )
# Pcbnew tests, so pretend to be pcbnew (for units, etc) # Pcbnew tests, so pretend to be pcbnew (for units, etc)
@ -89,6 +85,7 @@ include_directories(
target_link_libraries( qa_pcbnew target_link_libraries( qa_pcbnew
qa_pcbnew_utils qa_pcbnew_utils
pcbnew_kiface_objects
3d-viewer 3d-viewer
connectivity connectivity
pcbcommon pcbcommon