From d0de402c3025219ead9aa07fcd2e7cf8d03294c6 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 17 May 2013 16:18:04 +0000
Subject: [PATCH] trying to use install() to create "light" python wrappers

---
 CMakeLists.txt                 |  2 +-
 wrappers/gmshpy/CMakeLists.txt | 23 +++++------------------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7593c1c9d..2fe1886e45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1288,7 +1288,7 @@ endif(ENABLE_BUILD_LIB)
 if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
   install(TARGETS shared DESTINATION ${GMSH_LIB} OPTIONAL)
   if(WIN32 OR CYGWIN)
-    
+    # copy missing dlls    
   endif(WIN32 OR CYGWIN)
 endif(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
 
diff --git a/wrappers/gmshpy/CMakeLists.txt b/wrappers/gmshpy/CMakeLists.txt
index 843c9637eb..c3e1bb21b0 100644
--- a/wrappers/gmshpy/CMakeLists.txt
+++ b/wrappers/gmshpy/CMakeLists.txt
@@ -108,18 +108,11 @@ string(REPLACE ";" "\", \"" GMSH_PYTHON_MODULES "${SWIG_MODULES}")
 set(GMSH_PYTHON_MODULES "\"${GMSH_PYTHON_MODULES}\"")
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
 
-add_custom_target("_gmshpy" DEPENDS ${GMSHPY_DEPENDS})
-add_custom_command(TARGET _gmshpy POST_BUILD 
-  COMMAND ${CMAKE_COMMAND} -E make_directory "gmshpy"
-  COMMAND ${CMAKE_COMMAND} -E make_directory "gmshpy/extra_include"
-  COMMAND ${CMAKE_COMMAND} -E make_directory "gmshpy/src")
-add_custom_command(TARGET _gmshpy POST_BUILD 
-  COMMAND ${CMAKE_COMMAND} -E copy __init__.py.orig "gmshpy/src/__init__.py"
-  COMMAND ${CMAKE_COMMAND} -E copy setup.py "gmshpy/setup.py")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py.orig DESTINATION gmshpy/src RENAME __init__.py)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.py DESTINATION gmshpy)
 foreach(module ${SWIG_MODULES})
-  add_custom_command(TARGET _gmshpy POST_BUILD 
-    COMMAND ${CMAKE_COMMAND} -E copy ${module}PYTHON_wrap.cxx "gmshpy/src"
-    COMMAND ${CMAKE_COMMAND} -E copy ${module}.py "gmshpy/src")
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${module}PYTHON_wrap.cxx DESTINATION gmshpy/src)
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${module}.py DESTINATION gmshpy/src)
 endforeach(module)
 
 set (GMSH_PYTHON_EXTRA_INCLUDE 
@@ -154,11 +147,5 @@ set (GMSH_PYTHON_EXTRA_INCLUDE
 )
 
 foreach (file ${GMSH_PYTHON_EXTRA_INCLUDE})
-  add_custom_command(TARGET _gmshpy POST_BUILD 
-    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/../../${file}"  "gmshpy/extra_include")
+  install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../${file} DESTINATION gmshpy/extra_include)
 endforeach(file)
-
-add_custom_command(TARGET _gmshpy POST_BUILD 
-  COMMAND ${CMAKE_COMMAND} -E tar cfz gmshpy.tar.gz "gmshpy"
-  COMMAND ${CMAKE_COMMAND} -E remove_directory "gmshpy")
-
-- 
GitLab