[ 
https://issues.apache.org/jira/browse/XERCESC-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884146#comment-17884146
 ] 

Carlo Corradini commented on XERCESC-2246:
------------------------------------------

[~scantor]
The answer is straightforward: add include directories to the xerces-c target.
The following is the patch to make it work (no colors because Jira doesn't have 
a patch code formatter):
{code:none}
--- a/xerces/src/CMakeLists.txt
+++ b/xerces/src/CMakeLists.txt
@@ -1271,6 +1271,12 @@
 add_library(xerces-c
   ${libxerces_c_SOURCES}
   ${libxerces_c_RESOURCES})
+target_include_directories(
+  xerces-c
+  PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+         $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
 target_link_libraries(xerces-c PRIVATE ${libxerces_c_DEPS})
 if(XERCES_USE_NETACCESSOR_CURL)
   target_include_directories(xerces-c SYSTEM PRIVATE ${CURL_INCLUDE_DIRS})
{code}

I am not familiar with Jira, so if there is the possibility of creating a PR, I 
will without any problems.

> CMake target_include_directories
> --------------------------------
>
>                 Key: XERCESC-2246
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2246
>             Project: Xerces-C++
>          Issue Type: Improvement
>          Components: Build
>            Reporter: Carlo Corradini
>            Assignee: Scott Cantor
>            Priority: Major
>              Labels: buid, cmake
>             Fix For: 3.3.0
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I would like to use CMake's FetchContent with Xerces.
> Unfortunately, since Xerces does not specify its include directories, this is 
> not possible.
> The fix is really easy and short:
> Update src/CMakeLists.txt with the following code:
> {code}
> target_include_directories(
>   xerces-c
>   PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
> )
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to