From 9ed46fc275799266e0496aec2015fd2519bd5115 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 30 Apr 2019 16:53:26 -0400 Subject: [PATCH] [libcalamares] [locale] Adjust CMakeLists to moved code --- src/libcalamares/CMakeLists.txt | 34 ++++++++++++++++++++++++++++++- src/modules/locale/CMakeLists.txt | 30 --------------------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 4aa7c44df..7ef9843b9 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -69,7 +69,20 @@ if( WITH_PYTHON ) ) endif() -add_library( calamares SHARED ${libSources} ${kdsagSources} ${utilsSources} ) +set( geoipSources + geoip/GeoIP.cpp + geoip/GeoIPJSON.cpp +) +set( geoip_libs ) + +find_package(Qt5 COMPONENTS Xml) +if( Qt5Xml_FOUND ) + list( APPEND geoipSources geoip/GeoIPXML.cpp ) + list( APPEND geoip_libs Qt5::Network Qt5::Xml ) + add_definitions( -DHAVE_XML ) +endif() + +add_library( calamares SHARED ${libSources} ${kdsagSources} ${utilsSources} ${geoipSources} ) set_target_properties( calamares PROPERTIES VERSION ${CALAMARES_VERSION_SHORT} @@ -82,6 +95,7 @@ target_link_libraries( calamares ${OPTIONAL_PRIVATE_LIBRARIES} LINK_PUBLIC ${YAMLCPP_LIBRARY} + ${geoip_libs} Qt5::Core ) @@ -103,6 +117,24 @@ if ( ECM_FOUND AND BUILD_TESTING ) Qt5::Test ) calamares_automoc( libcalamarestest ) + + ecm_add_test( + geoip/GeoIPTests.cpp + ${geoip_src} + TEST_NAME + geoiptest + LINK_LIBRARIES + calamares + Qt5::Test + ${YAMLCPP_LIBRARY} + ) + calamares_automoc( geoiptest ) +endif() + +if( BUILD_TESTING ) + add_executable( test_geoip geoip/test_geoip.cpp ${geoip_src} ) + target_link_libraries( test_geoip calamares Qt5::Network ${YAMLCPP_LIBRARY} ) + calamares_automoc( test_geoip ) endif() # Make symlink lib/calamares/libcalamares.so to lib/libcalamares.so.VERSION so diff --git a/src/modules/locale/CMakeLists.txt b/src/modules/locale/CMakeLists.txt index affaa3753..768a67543 100644 --- a/src/modules/locale/CMakeLists.txt +++ b/src/modules/locale/CMakeLists.txt @@ -8,16 +8,6 @@ endif() include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) -set( geoip_src GeoIP.cpp GeoIPJSON.cpp ) -set( geoip_libs ) - -find_package(Qt5 COMPONENTS Xml) -if( Qt5Xml_FOUND ) - list( APPEND geoip_src GeoIPXML.cpp ) - list( APPEND geoip_libs Qt5::Xml ) - add_definitions( -DHAVE_XML ) -endif() - calamares_add_plugin( locale TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO @@ -42,20 +32,6 @@ calamares_add_plugin( locale ) if( ECM_FOUND AND BUILD_TESTING ) - ecm_add_test( - GeoIPTests.cpp - ${geoip_src} - TEST_NAME - geoiptest - LINK_LIBRARIES - calamaresui - Qt5::Network - Qt5::Test - ${geoip_libs} - ${YAMLCPP_LIBRARY} - ) - calamares_automoc( geoiptest ) - ecm_add_test( Tests.cpp LocaleConfiguration.cpp @@ -67,9 +43,3 @@ if( ECM_FOUND AND BUILD_TESTING ) ) calamares_automoc( localetest ) endif() - -if( BUILD_TESTING ) - add_executable( test_geoip test_geoip.cpp ${geoip_src} ) - target_link_libraries( test_geoip calamaresui Qt5::Network ${geoip_libs} ${YAMLCPP_LIBRARY} ) - calamares_automoc( test_geoip ) -endif()