I found answer to this question, just forgot to
target_link_libraries(libcft -L/usr/local/lib)

2015-11-24 2:38 GMT+03:00 Dmitrii Golub <dmitrii.go...@gmail.com>:

> Hello,
>
> 2 folders:
> src/bin/cft.c  <- cft target
> src/cft/signature.c and src/cft/ssl.c <- libcft target
>
> So libcft target:
>
> pkg_search_module(XMLSEC REQUIRED xmlsec1)
> include_directories(${XMLSEC_INCLUDE_DIRS})
>
> add_library(libcft signature.c ssl.c)
> target_link_libraries(libcft ${XMLSEC_LIBRARIES})
> target_compile_definitions(libcft PUBLIC ${XMLSEC_CFLAGS_OTHER})
>
> Not cft target version 1:
> add_executable(cft cft.c)
> target_link_libraries(cft libcft)
>
>
> I have to say, that XMLSEC_CFLAGS_OTHER is bunch of definitions:
> -DXMLSEC_CRYPTO=\"openssl\" -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1
> -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1
> -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1
>
> With cft target version 1 cmake doesnt use this definitions, So I got
> error:
>
> Linking C executable ../../bin/cft
> cd /mili/cp-proxy/src/bin && /usr/bin/cmake -E cmake_link_script
> CMakeFiles/cft.dir/link.txt --verbose=1
> /usr/bin/cc     CMakeFiles/cft.dir/cft.c.o  -o ../../bin/cft -rdynamic
> ../cft/liblibcft.a -lcurl -lxmlsec1 -lltdl -lxslt -lxml2 -lssl -lcrypto
> /usr/local/lib/libxmlsec1.so ../lib/libBASE64.a -Wl,-rpath,/usr/local/lib
> ../cft/liblibcft.a(signature.c.o): In function `cft_utils_init':
> signature.c:(.text+0xac1): undefined reference to
> `xmlSecCryptoDLLoadLibrary'
>
> So here come cft target version 2:
>
> pkg_search_module(XMLSEC REQUIRED xmlsec1)
> add_executable(cft cft.c)
> target_compile_definitions(cft PUBLIC ${XMLSEC_CFLAGS_OTHER}) <-- main
> line here
> target_link_libraries(cft libcft)
>
> Again:
>
> Linking C executable ../../bin/cft
> cd /mili/cp-proxy/src/bin && /usr/bin/cmake -E cmake_link_script
> CMakeFiles/cft.dir/link.txt --verbose=1
> /usr/bin/cc     CMakeFiles/cft.dir/cft.c.o  -o ../../bin/cft -rdynamic
> ../cft/liblibcft.a -lcurl -lxmlsec1 -lltdl -lxslt -lxml2 -lssl -lcrypto
> /usr/local/lib/libxmlsec1.so ../lib/libBASE64.a -Wl,-rpath,/usr/local/lib
> ../cft/liblibcft.a(signature.c.o): In function `cft_utils_init':
> signature.c:(.text+0xac1): undefined reference to
> `xmlSecCryptoDLLoadLibrary'
>
> cft version 3
> I tried to add add_definition by hand, but no succes, cmake doesn't use
> these definitions for cft target.
>
> Any ideas how to compile that with xmlsec definitions?
>
> Thanks
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to