Hi Brad and Domen and others,

I was looking at this issue
http://public.kitware.com/Bug/view.php?id=13009

and apparently it is not possible to install empty directories (I just tested).

I believe that it should be possible to do that (even if there are better ways like postinst).
What is your opinion?

The attached patch addresses this (and adds the corresponding test). It is based on my previous patch "0001-CPackDeb-preventing-md5sum-on-symlinks.patch".

Thanks,
Raffi

From 96a0b35d408f8c0d9310eb753e95ed5d1f37424e Mon Sep 17 00:00:00 2001
From: Raffi Enficiaud <raffi.enfici...@mines-paris.org>
Date: Mon, 14 Sep 2015 15:25:50 +0200
Subject: [PATCH] CPackDeb: enables empty directories in packages

---
 Source/CPack/cmCPackDebGenerator.cxx    | 2 ++
 Tests/CPackComponentsDEB/CMakeLists.txt | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Source/CPack/cmCPackDebGenerator.cxx 
b/Source/CPack/cmCPackDebGenerator.cxx
index 090c076..3c2189f 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -95,6 +95,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string 
initialTopLevel,
   std::string findExpr(this->GetOption("GEN_WDIR"));
   findExpr += "/*";
   gl.RecurseOn();
+  gl.SetRecurseListDirs(true);
   if ( !gl.FindFiles(findExpr) )
     {
     cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -222,6 +223,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne()
   std::string findExpr(this->GetOption("GEN_WDIR"));
   findExpr += "/*";
   gl.RecurseOn();
+  gl.SetRecurseListDirs(true);
   if ( !gl.FindFiles(findExpr) )
     {
     cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt 
b/Tests/CPackComponentsDEB/CMakeLists.txt
index 8ed81ac..d4bd9f1 100644
--- a/Tests/CPackComponentsDEB/CMakeLists.txt
+++ b/Tests/CPackComponentsDEB/CMakeLists.txt
@@ -104,9 +104,8 @@ install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest
 if(EXISTS "./dirtest")
   execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest)
 endif()
+# NOTE: directory left empty on purpose
 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest)
-# BUG: apparently cannot add an empty directory
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../mylibapp 
./dirtest/symtest)
 # NOTE: we should not add the trailing "/" to dirtest
 install(DIRECTORY ${CPackComponentsDEB_BINARY_DIR}/dirtest
         DESTINATION bin/
-- 
1.9.1

-- 

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-developers

Reply via email to