CMake: Modernize Boost import to use imported targets

This commit is contained in:
Ian McInerney 2023-03-10 13:22:42 +00:00
parent d3ae535885
commit a6ebd60c3b
24 changed files with 60 additions and 51 deletions

View File

@ -115,7 +115,7 @@ target_link_libraries( 3d-viewer
gal gal
kimath kimath
nlohmann_json nlohmann_json
${Boost_LIBRARIES} Boost::headers
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
kicad_3dsg ) kicad_3dsg )

View File

@ -804,9 +804,11 @@ find_package( Pixman 0.30 REQUIRED )
include_directories( SYSTEM ${PIXMAN_INCLUDE_DIR} ) include_directories( SYSTEM ${PIXMAN_INCLUDE_DIR} )
# #
# Find Boost headers, required. # Find Boost headers and libraries, required.
find_package( Boost 1.71.0 REQUIRED ) if( KICAD_BUILD_QA_TESTS )
include_directories( SYSTEM ${Boost_INCLUDE_DIR} ) list( APPEND BOOST_REQUESTED_COMPONENTS unit_test_framework system )
endif()
find_package( Boost 1.71.0 REQUIRED COMPONENTS ${BOOST_REQUESTED_COMPONENTS} )
# #
# Libraries required for outline font support. # Libraries required for outline font support.

View File

@ -489,7 +489,7 @@ target_link_libraries( common
compoundfilereader compoundfilereader
pcm_settings pcm_settings
nanodbc # for now; maybe hoist out of common nanodbc # for now; maybe hoist out of common
${Boost_LIBRARIES} Boost::headers
${CURL_LIBRARIES} ${CURL_LIBRARIES}
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${EXTRA_LIBS} ${EXTRA_LIBS}

View File

@ -74,12 +74,10 @@ target_link_libraries( cvpcb_kiface
common common
kimath kimath
${PCBNEW_IO_LIBRARIES} ${PCBNEW_IO_LIBRARIES}
Boost::headers
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )
# Must follow github_plugin
target_link_libraries( cvpcb_kiface ${Boost_LIBRARIES} )
target_include_directories( cvpcb_kiface PRIVATE target_include_directories( cvpcb_kiface PRIVATE
$<TARGET_PROPERTY:thread-pool,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:thread-pool,INTERFACE_INCLUDE_DIRECTORIES>
) )

View File

@ -489,6 +489,7 @@ target_link_libraries( eeschema_kiface
markdown_lib markdown_lib
scripting scripting
sexpr sexpr
Boost::headers
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )

View File

@ -36,8 +36,8 @@ target_link_libraries( kimath
clipper2 clipper2
othermath othermath
rtree rtree
Boost::headers
${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT ${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT
${Boost_LIBRARIES} # Because of the OPT types
) )
target_include_directories( kimath PUBLIC target_include_directories( kimath PUBLIC
@ -49,5 +49,4 @@ target_include_directories( kimath PUBLIC
target_include_directories( kimath PRIVATE target_include_directories( kimath PRIVATE
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${Boost_INCLUDE_DIR}
) )

View File

@ -631,6 +631,7 @@ target_link_libraries( pcbnew_kiface_objects
nlohmann_json nlohmann_json
rectpack2d rectpack2d
gzip-hpp gzip-hpp
Boost::boost
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${OCC_LIBRARIES} ${OCC_LIBRARIES}
) )
@ -679,7 +680,7 @@ set( PCBNEW_KIFACE_LIBRARIES
${PCBNEW_IO_LIBRARIES} ${PCBNEW_IO_LIBRARIES}
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES} Boost::headers
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )

View File

@ -45,7 +45,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/eeschema ${CMAKE_SOURCE_DIR}/eeschema
${CMAKE_SOURCE_DIR}/eeschema/sim ${CMAKE_SOURCE_DIR}/eeschema/sim
${CMAKE_SOURCE_DIR}/qa/eeschema_utils/include ${CMAKE_SOURCE_DIR}/qa/eeschema_utils/include
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
@ -63,10 +62,10 @@ target_link_libraries( ibis_proto
tinyspline_lib tinyspline_lib
nanosvg nanosvg
idf3 idf3
Boost::headers
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES}
${EESCHEMA_EXTRA_LIBS} # -lrt must follow Boost ${EESCHEMA_EXTRA_LIBS} # -lrt must follow Boost
) )

View File

@ -60,6 +60,9 @@ add_dependencies( qa_pcbnew_utils
target_link_libraries( qa_pcbnew_utils PUBLIC target_link_libraries( qa_pcbnew_utils PUBLIC
qa_utils qa_utils
Boost::headers
Boost::unit_test_framework
Boost::system
) )
# 3d-viewer # 3d-viewer
# connectivity # connectivity
@ -75,7 +78,6 @@ target_link_libraries( qa_pcbnew_utils PUBLIC
# ${PCBNEW_IO_LIBRARIES} # ${PCBNEW_IO_LIBRARIES}
# ${wxWidgets_LIBRARIES} # ${wxWidgets_LIBRARIES}
# ${PYTHON_LIBRARIES} # ${PYTHON_LIBRARIES}
# ${Boost_LIBRARIES} # must follow GITHUB
# ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost # ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
#) #)

View File

@ -19,8 +19,6 @@
# or you may write to the Free Software Foundation, Inc., # or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
find_package( Boost COMPONENTS unit_test_framework system REQUIRED )
set( QA_UTIL_COMMON_SRC set( QA_UTIL_COMMON_SRC
stdstream_line_reader.cpp stdstream_line_reader.cpp
utility_program.cpp utility_program.cpp
@ -49,8 +47,9 @@ endif()
target_link_libraries( qa_utils target_link_libraries( qa_utils
common common
turtle turtle
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} Boost::headers
${Boost_SYSTEM_LIBRARY} Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${LIBBOOST_UNIT_TEST_LIB} ${LIBBOOST_UNIT_TEST_LIB}
) )

View File

@ -79,7 +79,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/qa/qa_utils ${CMAKE_SOURCE_DIR}/qa/qa_utils
${CMAKE_SOURCE_DIR}/qa/qa_utils/include ${CMAKE_SOURCE_DIR}/qa/qa_utils/include
${CMAKE_SOURCE_DIR}/qa/pcbnew_utils/include ${CMAKE_SOURCE_DIR}/qa/pcbnew_utils/include
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
@ -97,10 +96,10 @@ target_link_libraries( drc_proto
tinyspline_lib tinyspline_lib
nanosvg nanosvg
idf3 idf3
Boost::headers
${PCBNEW_IO_LIBRARIES} ${PCBNEW_IO_LIBRARIES}
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES}
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )

View File

@ -58,7 +58,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/polygon ${CMAKE_SOURCE_DIR}/polygon
${CMAKE_SOURCE_DIR}/common/geometry ${CMAKE_SOURCE_DIR}/common/geometry
${CMAKE_SOURCE_DIR}/qa/qa_utils ${CMAKE_SOURCE_DIR}/qa/qa_utils
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
@ -72,8 +71,9 @@ target_link_libraries( test_gal_pixel_alignment
gal gal
common common
${PCBNEW_IO_LIBRARIES} ${PCBNEW_IO_LIBRARIES}
${Boost_SYSTEM_LIBRARY} Boost::headers
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )

View File

@ -21,7 +21,6 @@
# or you may write to the Free Software Foundation, Inc., # or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED ) find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
add_compile_definitions( BOOST_TEST_DYN_LINK PCBNEW) add_compile_definitions( BOOST_TEST_DYN_LINK PCBNEW)
@ -49,7 +48,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/common/geometry ${CMAKE_SOURCE_DIR}/common/geometry
${CMAKE_SOURCE_DIR}/qa/common ${CMAKE_SOURCE_DIR}/qa/common
${CMAKE_SOURCE_DIR}/qa/qa_utils ${CMAKE_SOURCE_DIR}/qa/qa_utils
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
@ -76,7 +74,8 @@ target_link_libraries( libeval_compiler_test
${PCBNEW_IO_LIBRARIES} ${PCBNEW_IO_LIBRARIES}
common common
pcbcommon pcbcommon
${Boost_SYSTEM_LIBRARY} Boost::headers
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )

View File

@ -64,7 +64,8 @@ target_link_libraries( test_window
gal gal
common common
${PCBNEW_IO_LIBRARIES} ${PCBNEW_IO_LIBRARIES}
${Boost_SYSTEM_LIBRARY} Boost::headers
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )

View File

@ -56,7 +56,7 @@ target_link_libraries( qa_pcbnew_tools
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES} Boost::headers
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )

View File

@ -113,7 +113,7 @@ target_link_libraries( pns_debug_tool
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES} Boost::headers
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )
@ -137,7 +137,7 @@ target_link_libraries( qa_pns_regressions
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES} Boost::headers
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )
@ -157,8 +157,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/qa/common ${CMAKE_SOURCE_DIR}/qa/common
${CMAKE_SOURCE_DIR}/qa/qa_utils ${CMAKE_SOURCE_DIR}/qa/qa_utils
${CMAKE_SOURCE_DIR}/qa/qa_utils/include ${CMAKE_SOURCE_DIR}/qa/qa_utils/include
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )

View File

@ -62,14 +62,6 @@ if( KICAD_TEST_DATABASE_LIBRARIES )
set( QA_COMMON_SRCS ${QA_COMMON_SRCS} test_database.cpp ) set( QA_COMMON_SRCS ${QA_COMMON_SRCS} test_database.cpp )
endif() endif()
set( QA_COMMON_LIBS
common
libcontext
gal
qa_utils
${wxWidgets_LIBRARIES}
)
if( WIN32 ) if( WIN32 )
# We want to declare a resource manifest on Windows to enable UTF8 mode # We want to declare a resource manifest on Windows to enable UTF8 mode
# Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well # Without UTF8 mode, some random IO tests may fail, we set the active code page on normal kicad to UTF8 as well
@ -86,7 +78,17 @@ endif()
add_executable( qa_common add_executable( qa_common
${QA_COMMON_SRCS} ${QA_COMMON_SRCS}
${QA_COMMON_RESOURCES} ) ${QA_COMMON_RESOURCES} )
target_link_libraries( qa_common ${QA_COMMON_LIBS} )
target_link_libraries( qa_common
common
libcontext
gal
qa_utils
Boost::headers
Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES}
)
include_directories( include_directories(
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}

View File

@ -130,7 +130,9 @@ PRIVATE
qa_schematic_utils qa_schematic_utils
markdown_lib markdown_lib
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${Boost_LIBRARIES} Boost::headers
Boost::unit_test_framework
Boost::system
) )
if( KICAD_SPICE AND KICAD_SPICE_QA AND MSVC ) if( KICAD_SPICE AND KICAD_SPICE_QA AND MSVC )

View File

@ -68,7 +68,9 @@ target_link_libraries( qa_gerbview
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES} # must follow GITHUB Boost::headers
Boost::unit_test_framework
Boost::system
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )

View File

@ -70,6 +70,9 @@ add_executable( qa_kimath
target_link_libraries( qa_kimath target_link_libraries( qa_kimath
qa_utils qa_utils
kimath kimath
Boost::headers
Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )

View File

@ -34,6 +34,9 @@ add_executable( qa_sexpr ${SEXPR_SRCS} )
target_link_libraries( qa_sexpr target_link_libraries( qa_sexpr
sexpr sexpr
qa_utils qa_utils
Boost::headers
Boost::unit_test_framework
Boost::system
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
) )

View File

@ -94,7 +94,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/polygon ${CMAKE_SOURCE_DIR}/polygon
${CMAKE_SOURCE_DIR}/common/geometry ${CMAKE_SOURCE_DIR}/common/geometry
${CMAKE_SOURCE_DIR}/qa/qa_utils ${CMAKE_SOURCE_DIR}/qa/qa_utils
${Boost_INCLUDE_DIR}
${INC_AFTER} ${INC_AFTER}
) )
@ -119,7 +118,9 @@ target_link_libraries( qa_pcbnew
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES} Boost::headers
Boost::unit_test_framework
Boost::system
${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost ${PCBNEW_EXTRA_LIBS} # -lrt must follow Boost
) )

View File

@ -9,8 +9,8 @@ add_library( scripting STATIC
target_link_libraries( scripting target_link_libraries( scripting
${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT ${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT
${Boost_LIBRARIES} # Because of the OPT types
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
Boost::headers
common common
) )
@ -25,7 +25,6 @@ target_include_directories( scripting PRIVATE
${PROJECT_SOURCE_DIR}/resources/bitmaps_png/include ${PROJECT_SOURCE_DIR}/resources/bitmaps_png/include
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${Boost_INCLUDE_DIR}
) )
# Setup the KIFACE # Setup the KIFACE
@ -44,7 +43,6 @@ target_include_directories( scripting_kiface PRIVATE
${PROJECT_SOURCE_DIR}/resources/bitmaps_png/include ${PROJECT_SOURCE_DIR}/resources/bitmaps_png/include
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${Boost_INCLUDE_DIR}
) )
if( MSVC ) if( MSVC )

View File

@ -2,7 +2,6 @@ include_directories(
"${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/include"
"${CMAKE_SOURCE_DIR}/utils/idftools" "${CMAKE_SOURCE_DIR}/utils/idftools"
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
) )
set( IDF3_FILES set( IDF3_FILES
@ -20,6 +19,7 @@ endif( MINGW )
add_library( idf3 STATIC ${IDF3_FILES} ) add_library( idf3 STATIC ${IDF3_FILES} )
target_link_libraries( idf3 target_link_libraries( idf3
kimath kimath
Boost::headers
) )
add_executable( idfcyl idf_cylinder.cpp ) add_executable( idfcyl idf_cylinder.cpp )