fgerlits commented on a change in pull request #1138:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1138#discussion_r677585723



##########
File path: cmake/Extensions.cmake
##########
@@ -26,7 +26,27 @@ macro(register_extension extension-name)
   get_property(extensions GLOBAL PROPERTY EXTENSION-OPTIONS)
   set_property(GLOBAL APPEND PROPERTY EXTENSION-OPTIONS ${extension-name})
   target_compile_definitions(${extension-name} PRIVATE 
"MODULE_NAME=${extension-name}")
-  set_target_properties(${extension-name} PROPERTIES ENABLE_EXPORTS True)
+  set_target_properties(${extension-name} PROPERTIES
+          ENABLE_EXPORTS True
+          POSITION_INDEPENDENT_CODE ON)
+  if (WIN32)
+    set_target_properties(${extension-name} PROPERTIES
+        RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+        ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+        WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+  else()
+    set_target_properties(${extension-name} PROPERTIES 
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+  endif()
+
+  if (WIN32)
+    install(TARGETS ${extension-name} RUNTIME DESTINATION extensions COMPONENT 
bin)
+  else()
+    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+      target_link_options(${extension-name} PRIVATE "-Wl,--disable-new-dtags")
+    endif()
+    set_target_properties(${extension-name} PROPERTIES INSTALL_RPATH "$ORIGIN")

Review comment:
       does this work?  no escaping of the `$` is needed?
   
   there is also a BUILD_RPATH_USE_ORIGIN CMake option that may be useful here
   
   EDIT: I tested it with `make u20` and it does work, so never mind




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to