From 40ac705db0d93047f85ca6d9ef2587a64086688c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 12 Mar 2020 11:24:59 +0100 Subject: [PATCH] Fix cmake build issues (#5670) * Fix cmake build issues * Temporary force linking of external object --- .../Application/RiaApplication.cpp | 6 ++++++ Fwk/AppFwk/cafPdmScripting/CMakeLists.txt | 19 +------------------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 0b34c18dd3..527e8ac9d7 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -1709,6 +1709,12 @@ bool RiaApplication::generateCode( const QString& fileName, QString* errMsg ) std::string fileExt = QFileInfo( fileName ).suffix().toStdString(); + { + // TODO: Manually instantiate the markdown generator until cmake issues are fixed + // This will make sure the markdown generator is registered in the factory in the cafPdmScripting library + caf::PdmMarkdownGenerator testObj; + } + std::unique_ptr generator( caf::PdmCodeGeneratorFactory::instance()->create( fileExt ) ); if ( !generator ) { diff --git a/Fwk/AppFwk/cafPdmScripting/CMakeLists.txt b/Fwk/AppFwk/cafPdmScripting/CMakeLists.txt index 613644eb1a..5d66b7eecf 100644 --- a/Fwk/AppFwk/cafPdmScripting/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmScripting/CMakeLists.txt @@ -27,12 +27,7 @@ set( PROJECT_FILES ) -# NOTE! Adding the library as a cmake "OBJECT" library -# to make sure the linker is not pruning the seemingly unused features, -# and to make sure that the static initialization based registration of the features into the factory is done properly -# see https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/Object-Library -# and https://cmake.org/cmake/help/v3.15/command/add_library.html?highlight=add_library#object-libraries -add_library( ${PROJECT_NAME} OBJECT +add_library( ${PROJECT_NAME} ${PROJECT_FILES} ) @@ -47,18 +42,6 @@ target_link_libraries ( ${PROJECT_NAME} LibCore ) -# Before cmake 3.12 OBJECT libraries could not use the target_link_libraries command, -# So we need to set the POSITION_INDEPENDENT_CODE option manually - -set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON) - -# Not to be used until we can use cmake 3.12 or above -#target_link_libraries ( ${PROJECT_NAME} -# cafCommand -# cafUserInterface -# ${QT_LIBRARIES} -#) - source_group("" FILES ${PROJECT_FILES})