CMake: tidy up automatic linking of Calamares libraries
- Modules and plugins don't need to mention libcalamares themselves for linking -- we can do that automatically. Use the IMPORTED names so that it works in Calamares main repo and external repositories. - Complain about unknown module types.
This commit is contained in:
parent
cbb1a5ef36
commit
4d1630bf8b
@ -126,6 +126,15 @@ function( calamares_add_plugin )
|
|||||||
# create target name once for convenience
|
# create target name once for convenience
|
||||||
set( target "calamares_${PLUGIN_TYPE}_${PLUGIN_NAME}" )
|
set( target "calamares_${PLUGIN_TYPE}_${PLUGIN_NAME}" )
|
||||||
|
|
||||||
|
# automatic library linkage
|
||||||
|
if(PLUGIN_TYPE STREQUAL "view" OR PLUGIN_TYPE STREQUAL "viewmodule")
|
||||||
|
list(APPEND PLUGIN_LINK_PRIVATE_LIBRARIES Calamares::calamaresui)
|
||||||
|
elseif(PLUGIN_TYPE STREQUAL "job")
|
||||||
|
list(APPEND PLUGIN_LINK_PRIVATE_LIBRARIES Calamares::calamares)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unknown plugin type ${PLUGIN_TYPE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# determine target type
|
# determine target type
|
||||||
if( NOT ${PLUGIN_SHARED_LIB} )
|
if( NOT ${PLUGIN_SHARED_LIB} )
|
||||||
set( target_type "MODULE" )
|
set( target_type "MODULE" )
|
||||||
|
@ -36,7 +36,7 @@ function( calamares_add_test )
|
|||||||
TEST_NAME
|
TEST_NAME
|
||||||
${TEST_NAME}
|
${TEST_NAME}
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
calamares
|
Calamares::calamares
|
||||||
${TEST_LIBRARIES}
|
${TEST_LIBRARIES}
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Test
|
Qt5::Test
|
||||||
@ -46,7 +46,7 @@ function( calamares_add_test )
|
|||||||
# compiled, so that it can find test-files in that source dir.
|
# compiled, so that it can find test-files in that source dir.
|
||||||
target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS} )
|
target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS} )
|
||||||
if( TEST_GUI )
|
if( TEST_GUI )
|
||||||
target_link_libraries( ${TEST_NAME} calamaresui Qt5::Gui )
|
target_link_libraries( ${TEST_NAME} Calamares::calamaresui Qt5::Gui )
|
||||||
endif()
|
endif()
|
||||||
if( TEST_RESOURCES )
|
if( TEST_RESOURCES )
|
||||||
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
|
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
|
||||||
|
Loading…
Reference in New Issue
Block a user