[CMake] ExternalProject_add not buing launched

Michele Portolan michele.portolan at grenoble-inp.fr
Mon Feb 27 17:00:05 EST 2017


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





More information about the CMake mailing list