[libcxx] r279675 - [CMake] Be more consistent about naming targets and components

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 24 15:17:06 PDT 2016


Author: cbieneman
Date: Wed Aug 24 17:17:06 2016
New Revision: 279675

URL: http://llvm.org/viewvc/llvm-project?rev=279675&view=rev
Log:
[CMake] Be more consistent about naming targets and components

Summary:
The point of this patch is to have a consistent convention for naming build, check and install targets so that the targets can be constructed from the project name.

This change renames a bunch of CMake components and targets from libcxx to cxx. For each renamed target I've added a convenience target that matches the old target name and depends on the new target. This will preserve function of the old targets so that the change doesn't break the world. We can evaluate if it is worth removing the extra targets later.

Reviewers: EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D23699

Modified:
    libcxx/trunk/include/CMakeLists.txt
    libcxx/trunk/lib/CMakeLists.txt
    libcxx/trunk/test/CMakeLists.txt

Modified: libcxx/trunk/include/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=279675&r1=279674&r2=279675&view=diff
==============================================================================
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Wed Aug 24 17:17:06 2016
@@ -19,7 +19,7 @@ file(COPY .
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
     DESTINATION include/c++/v1
-    COMPONENT libcxx-headers
+    COMPONENT cxx-headers
     FILES_MATCHING
     ${LIBCXX_HEADER_PATTERN}
     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
@@ -47,17 +47,20 @@ if (LIBCXX_INSTALL_HEADERS)
       DESTINATION include/c++/v1
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
       RENAME __config
-      COMPONENT libcxx-headers)
+      COMPONENT cxx-headers)
   endif()
 
   if (NOT CMAKE_CONFIGURATION_TYPES)
     # this target is just needed as a placeholder for the distribution target
-    add_custom_target(libcxx-headers)
-    add_custom_target(install-libcxx-headers
-                      DEPENDS libcxx-headers ${generated_config_deps}
+    add_custom_target(cxx-headers)
+    add_custom_target(install-cxx-headers
+                      DEPENDS cxx-headers ${generated_config_deps}
                       COMMAND "${CMAKE_COMMAND}"
-                              -DCMAKE_INSTALL_COMPONENT=libcxx-headers
+                              -DCMAKE_INSTALL_COMPONENT=cxx-headers
                               -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+
+    add_custom_target(libcxx-headers)
+    add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
   endif()
 
 endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=279675&r1=279674&r2=279675&view=diff
==============================================================================
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Wed Aug 24 17:17:06 2016
@@ -225,8 +225,8 @@ if (LIBCXX_INSTALL_LIBRARY)
     set(experimental_lib cxx_experimental)
   endif()
   install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
-    LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-    ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+    LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+    ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
     )
   # NOTE: This install command must go after the cxx install command otherwise
   # it will not be executed after the library symlinks are installed.
@@ -248,13 +248,14 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND (L
       set(experimental_lib_install_target cxx_experimental)
     endif()
     if(LIBCXX_INSTALL_HEADERS)
-      set(header_install_target install-libcxx-headers)
+      set(header_install_target install-cxx-headers)
     endif()
-    add_custom_target(install-libcxx
+    add_custom_target(install-cxx
                       DEPENDS ${lib_install_target}
                               ${experimental_lib_install_target}
                               ${header_install_target}
                       COMMAND "${CMAKE_COMMAND}"
-                      -DCMAKE_INSTALL_COMPONENT=libcxx
+                      -DCMAKE_INSTALL_COMPONENT=cxx
                       -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
+    add_custom_target(install-libcxx DEPENDS install-cxx)
 endif()

Modified: libcxx/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=279675&r1=279674&r2=279675&view=diff
==============================================================================
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Wed Aug 24 17:17:06 2016
@@ -52,11 +52,13 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   set(experimental_dep cxx_experimental)
 endif()
 
-add_lit_testsuite(check-libcxx
+add_lit_testsuite(check-cxx
   "Running libcxx tests"
   ${CMAKE_CURRENT_BINARY_DIR}
   DEPENDS cxx ${experimental_dep})
 
+add_custom_target(check-libcxx DEPENDS check-cxx)
+
 if (LIBCXX_GENERATE_COVERAGE)
   include(CodeCoverage)
   set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")




More information about the cfe-commits mailing list