mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-18 17:15:15 -05:00
Support cmake version < 3.12 on the OBJECT type library cafCommandFeatures
This commit is contained in:
@@ -428,6 +428,9 @@ if (RESINSIGHT_INCLUDE_APPFWK_TESTS)
|
||||
set_property(TARGET cafPdmXml_UnitTests PROPERTY FOLDER "AppFwkTests")
|
||||
|
||||
# Executables
|
||||
add_subdirectory(Fwk/AppFwk/cafCommandFeatures)
|
||||
set_property(TARGET cafCommandFeatures PROPERTY FOLDER "AppFwk")
|
||||
|
||||
add_subdirectory(Fwk/AppFwk/cafTests/cafTestApplication)
|
||||
set_property(TARGET cafTestApplication PROPERTY FOLDER "AppFwkTests")
|
||||
endif()
|
||||
|
||||
@@ -74,14 +74,23 @@ add_library( ${PROJECT_NAME} OBJECT
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
$<TARGET_PROPERTY:cafCommand,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
|
||||
$<TARGET_PROPERTY:cafUserInterface,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
|
||||
)
|
||||
|
||||
target_link_libraries ( ${PROJECT_NAME}
|
||||
cafCommand
|
||||
cafUserInterface
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
# 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}
|
||||
#)
|
||||
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/W4 /wd4100 /wd4127")
|
||||
|
||||
@@ -67,6 +67,7 @@ add_executable ( ${PROJECT_NAME}
|
||||
${PROJECT_FILES}
|
||||
${MOC_SOURCE_FILES}
|
||||
${QRC_FILES_CPP}
|
||||
$<TARGET_OBJECTS:cafCommandFeatures> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries with OBJECT libraries
|
||||
)
|
||||
|
||||
set (TAP_LINK_LIBRARIES
|
||||
@@ -77,7 +78,7 @@ if (USE_COMMAND_FRAMEWORK)
|
||||
set (TAP_LINK_LIBRARIES
|
||||
${TAP_LINK_LIBRARIES}
|
||||
cafCommand
|
||||
cafCommandFeatures
|
||||
#cafCommandFeatures # Not possible using cmake version < 3.12. Use when we can use target_link_libraries with OBJECT libraries
|
||||
)
|
||||
endif(USE_COMMAND_FRAMEWORK)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user