Hello,

I am trying to set my Cmake project to build the "xmlrpc-c" library, which is built using autotools. I was somewhat able to set it up following this example: http://mirkokiefer.com/blog/2013/03/cmake-by-example/

My resulting CMakeList is the following:

ExternalProject_Add( project_xmlprc
  SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/xmlrpc-c"
  PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/xmlrpc-c"
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/xmlrpc-c/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/xmlrpc-c/
  BUILD_COMMAND make
  INSTALL_COMMAND make install
  BUILD_IN_SOURCE 1
)

ExternalProject_Get_Property(project_xmlprc install_dir)


add_library(xmlprc SHARED IMPORTED)
set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc++.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_packetsocket.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_client.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_client++.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_server++.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_server_abyss++.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_util.so) set_property(TARGET xmlprc PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libxmlrpc_util++.so)
add_dependencies(xmlprc project_xmlprc)

It sort of works, meaning I can see the library being built in ${CMAKE_CURRENT_BINARY_DIR}/xmlrpc-c/.

My problem is that the build is launched only the first time! If I delete the ${CMAKE_CURRENT_BINARY_DIR} and re-launch cmake, the ExternalProjet is not rebuilt. To have a rebuild, I have to do this strange workaround:

  - modify "BUILD_IN_SOURCE" to 0

 - run cmake+make. I get an error as xmlrpc only support in-source build

 - put "BUILD_IN_SOURCE"back to 1

 - run cmake+make. This time it works.


Looks like it is some issue in the source tree remaining dirty, but even running a "make distclean" does not change anything, I need to do the workaround.

Any idea of where the problem lies?

Thanks,


Michele



--

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