From d7d6d6bff05491f0d30e2910644de31f1df0c7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 23 May 2012 02:01:41 +0200 Subject: [PATCH] Reuse already compiled objects for unit test libraries. Speeds up compilation like infinity times. CMake 2.8.8 is required for OBJECT library target. --- src/Plugins/TgaImporter/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Plugins/TgaImporter/CMakeLists.txt b/src/Plugins/TgaImporter/CMakeLists.txt index d776849f9..eaf138d32 100644 --- a/src/Plugins/TgaImporter/CMakeLists.txt +++ b/src/Plugins/TgaImporter/CMakeLists.txt @@ -1,8 +1,13 @@ -corrade_add_plugin(TgaImporter ${MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR} TgaImporter.conf TgaImporter.cpp) +add_library(TgaImporterObjects OBJECT TgaImporter.cpp) +if(USE_FPIC) + set_target_properties(TgaImporterObjects PROPERTIES COMPILE_FLAGS -fPIC) +endif() + +corrade_add_plugin(TgaImporter ${MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR} TgaImporter.conf $) target_link_libraries(TgaImporter ${MAGNUM_LIBRARY}) if(BUILD_TESTS) - add_library(TgaImporterTestLib TgaImporter.cpp) + add_library(TgaImporterTestLib $) target_link_libraries(TgaImporterTestLib ${MAGNUM_LIBRARY} ${CORRADE_UTILITY_LIBRARY} ${CORRADE_PLUGINMANAGER_LIBRARY}) enable_testing() add_subdirectory(Test)