<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>body{font-family:Helvetica,Arial;font-size:13px}</style>
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
Sorry Srinivas, the projects was for a former employer of mine and I no longer have access to it. We were distributing “scripts” as executable zip files (a lesser known feature of Python). So we had a few things going on.</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br>
</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
include(FindPythonInterp)</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py @ONLY)</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
add_custom_command(${CMAKE_CURRENT_BINARY_DIR}/<executable name> COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py bdist -format zip COMMAND …)</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br>
</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
For the add_custom_command we ran more commands after invoking python to run the setup.py file. The extra commands were to rename from the normal distutils name to the final name and to prepend a UNIX #!/usr/bin/env python text line to the zip file. In this
 way you can make a self contained “executable” that on UNIX at least runs like any other binary.</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br>
</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
All of the add_custom_command logic to build these zip executables was put into a cmake function: </div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<a href="https://cmake.org/cmake/help/v3.3/command/function.html">https://cmake.org/cmake/help/v3.3/command/function.html</a></div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br>
</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
If you do go the function route I would recommend taking a look at the CMakeParseArguments module it was very useful for me.</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<a href="https://cmake.org/cmake/help/v3.3/module/CMakeParseArguments.html">https://cmake.org/cmake/help/v3.3/module/CMakeParseArguments.html</a></div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
<br>
</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
Sorry I don’t have more specifics.</div>
<br>
<div id="bloop_sign_1445535396720538112" class="bloop_sign">
<div style="font-family:helvetica,arial;font-size:13px">-- <br>
Matt Keeler<br>
</div>
</div>
<br>
<p class="airmail_on">On October 21, 2015 at 16:21:36, srinivas boppu (<a href="mailto:srinivas.boppu@gmail.com">srinivas.boppu@gmail.com</a>) wrote:</p>
<blockquote type="cite" class="clean_bq"><span>
<div>
<div></div>
<div>
<title></title>
<div dir="ltr">Hi Matthew Keeler,
<div><br>
</div>
<div>Thanks for your quick reply. My project is a pure python project. I wanted to use cmake and ctest for testing my individual python modules. Later on, I might have some "tcl" scripts and may be some c++ sources in the same project.</div>
<div><br>
</div>
<div>It would be great, if you could share your pure python project details and the macros or related documents.</div>
<div><br>
</div>
<div>Thanks and Regards,</div>
<div>Srinivas Boppu</div>
<div><br>
</div>
<div><br>
</div>
<div> </div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Oct 21, 2015 at 9:52 PM, Matthew Keeler <span dir="ltr">
<<a href="mailto:mkeeler@tenable.com" target="_blank">mkeeler@tenable.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
What are you trying to do? Are you trying to build Python C extensions? If so then the FindPythonLibs module will help you in that regard. It will determine if the Python development files are installed and populate variables with the necessary paths to provide
 to link_directories and include_directories. <a href="https://cmake.org/cmake/help/v3.3/module/FindPythonLibs.html" target="_blank">https://cmake.org/cmake/help/v3.3/module/FindPythonLibs.html</a></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br>
</div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Additionally there is the FindPythonInterp module which will find the Python interpreter for invoking via custom commands or execute_process.</div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<a href="https://cmake.org/cmake/help/v3.3/module/FindPythonInterp.html" target="_blank">https://cmake.org/cmake/help/v3.3/module/FindPythonInterp.html</a></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br>
</div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
Also if you aren’t actually compiling any C/C++ code it will speed up build system generation if you specify the languages as NONE during the project command invocation. That behavior is documented at: <a href="https://cmake.org/cmake/help/v3.3/command/project.html" target="_blank">https://cmake.org/cmake/help/v3.3/command/project.html</a></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br>
</div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
In the past I have used cmake even for pure Python projects to just get the benefits of generic packaging with cpack and to be able to use ctest. If this is the case for you then you may end up defining a bunch of functions/macros to do all the work as I did.</div>
<br>
<div>
<div style="font-family:helvetica,arial;font-size:13px">-- <br>
Matt Keeler<br>
</div>
</div>
<div>
<div class="h5"><br>
<p>On October 21, 2015 at 11:28:28, srinivas boppu (<a href="mailto:srinivas.boppu@gmail.com" target="_blank">srinivas.boppu@gmail.com</a>) wrote:</p>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div>
<div class="h5">
<div dir="ltr">
<div>
<div>
<div>
<div><span>Hello All,<br>
<br>
</span></div>
<span>I am new to cmake and its build and ctest system. I read some where that cmake default look for c++ compiler and we need to modify/configure the cmake to recongize the python files.<br>
</span></div>
<span>I googled for the same but I couldn't find any concrete and complete example.<br>
</span></div>
<span>Any pointers in this regard would be useful.<br>
<br>
</span></div>
<span>Thanks in advance.<br clear="all">
</span>
<div>
<div>
<div>
<div>
<div><span><br>
--<br>
</span>
<div><span>Apologizing doesn't mean U r wrong & the other is right,It means that U value the relationship more than Ur ego...<br>
<br>
</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<span>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">
http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">
http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">
http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">
http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></span></div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
--<br>
<div class="gmail_signature">Apologizing doesn't mean U r wrong & the other is right,It means that U value the relationship more than Ur ego...<br>
<br>
</div>
</div>
</div>
</div>
</span></blockquote>
</body>
</html>