]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: produce civetweb.h, again 12008/head
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 15 Nov 2016 22:43:16 +0000 (17:43 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 17 Nov 2016 18:49:14 +0000 (13:49 -0500)
The recent change to do this logic with file copy (and in src/rgw)
resolved the build problem, but now updates to the civetweb
submodule were not reflected in the build.

Move the copy into a custom target which will always source the
current submodule version at build time.

Avoid using the BYPRODUCTS option, as it is not supported in many
older cmake versions (e.g., Centos 7).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/CMakeLists.txt

index 9bd186117962ef9201f1b9632e1a99f87d51cf8a..768331ccb74185e459c016b0de3257cf6ad6680e 100644 (file)
@@ -17,6 +17,13 @@ install(TARGETS
   DESTINATION bin)
 endif(WITH_TESTS)
 
+add_custom_target(civetweb_h
+  COMMAND ${CMAKE_COMMAND} -E make_directory
+  "${CMAKE_BINARY_DIR}/src/include/civetweb"
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different
+  "${CMAKE_SOURCE_DIR}/src/civetweb/include/civetweb.h"
+  "${CMAKE_BINARY_DIR}/src/include/civetweb"
+  COMMENT "keep civetweb.h up-to-date")
 
 set(rgw_a_srcs
   rgw_acl.cc
@@ -96,16 +103,12 @@ set(rgw_a_srcs
 
 add_library(rgw_a STATIC ${rgw_a_srcs})
 
+add_dependencies(rgw_a civetweb_h)
+
 target_include_directories(rgw_a PUBLIC
   "../Beast/include"
   ${FCGI_INCLUDE_DIR})
 
-# we want to include civetweb.h as "civetweb/civetweb.h".  Make it so.
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/src/include/civetweb")
-file(COPY
-  "${CMAKE_SOURCE_DIR}/src/civetweb/include/civetweb.h"
-  DESTINATION "${CMAKE_BINARY_DIR}/src/include/civetweb")
-
 target_link_libraries(rgw_a librados cls_lock_client cls_rgw_client cls_refcount_client
   cls_log_client cls_statelog_client cls_timeindex_client cls_version_client
   cls_replica_log_client cls_user_client common common_utf8 global