<p>While I too find myself sometimes wanting convenience scripts - some people find the use of &#39;-DENABLE_&lt;whatever&gt;=ON&#39; instead of --enable-&lt;whatever&gt;&#39; foreign, for example - the problem with them, IMO, is that they&#39;re impossible to make crossplatform without requiring the presence of some tool - perl, python, bash, whatever - on each system in a location that can be located pre-configure, which is exactly what using cmake gets you out of.</p>

<p>Mm</p>
<div class="gmail_quote">On Feb 8, 2011 2:53 AM, &quot;Michael Wild&quot; &lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt; wrote:<br type="attribution">&gt; That&#39;s not how CMake works. With CMake developers usually have many<br>
&gt; binary trees referring to one single source tree (optimized/debug, 32/64<br>&gt; bit, with/without some optional dependencies, etc.). There is no good<br>&gt; way that CMake could automate the choice of suitable name of the binary<br>
&gt; tree (and scons fails there too, IMHO). So, AFAIK, the design choice was<br>&gt; to leave it up to the user.<br>&gt; <br>&gt; Some projects provide simple shell scripts or Makefiles to automate this<br>&gt; for a few simple cases (much the way you do), but IMHO it&#39;s not worth<br>
&gt; the hassle... If somebody is tech-savvy enough to build from source, you<br>&gt; can assume (s)he knows how to create a directory and what the CWD is.<br>&gt; <br>&gt; My 2c<br>&gt; <br>&gt; Michael<br>&gt; <br>&gt; On 02/08/2011 05:50 AM, Campbell Barton wrote:<br>
&gt;&gt; For blender we currently support 2 build systems - SCons and CMake,<br>&gt;&gt; Quite a few technical users build from source on *nix just to get the<br>&gt;&gt; latest version and use scons, I suspect this is because scons<br>
&gt;&gt; configures every time and its simple just to type &quot;scons&quot; in the<br>&gt;&gt; source dir and end up with a build.<br>&gt;&gt; We have SCons configured to do an out-of-source build by default with<br>&gt;&gt; a predefined directory.<br>
&gt;&gt; <br>&gt;&gt; I wasn&#39;t aware of anything similar for CMake so I write a GNUmakefile<br>&gt;&gt; (included below) in the root source dir to do something similar for<br>&gt;&gt; CMake.<br>&gt;&gt; (note, we don&#39;t allow in-source builds at the moment so there is no<br>
&gt;&gt; conflict with possible in-source makefiles).<br>&gt;&gt; <br>&gt;&gt; This makefile creates a per-defined out-of-source build dir if<br>&gt;&gt; necessary and runs make, since we explicitly list source files and<br>
&gt;&gt; headers in the CMakeLists.txt cmake will re-configure if needed.<br>&gt;&gt; <br>&gt;&gt; So my questions are...<br>&gt;&gt; - Do other projects do this? is there some preferred way to do this?<br>&gt;&gt; - Is it possible to setup the CMakeLists.txt so the generated<br>
&gt;&gt; makefiles are written to a directory other then the CWD?<br>&gt;&gt; - Is there any way to default to our-of-source build when running<br>&gt;&gt; &quot;cmake .&quot; in the source dir? (rather then aborting which is what we do<br>
&gt;&gt; now).<br>&gt;&gt; <br>&gt;&gt; Probably our users should just get the hang on setting up out of<br>&gt;&gt; source builds but I think they like the convenience.<br>&gt;&gt; <br>&gt;&gt; # ------------<br>&gt;&gt; # This Makefile does an out-of-source CMake build in ../build/`OS`_`CPU`<br>
&gt;&gt; # eg:<br>&gt;&gt; #   ../build/Linux_i386<br>&gt;&gt; # This is for users who like to configure &amp; build blender with a single command.<br>&gt;&gt; <br>&gt;&gt; # System Vars<br>&gt;&gt; OS:=$(shell uname -s)<br>
&gt;&gt; OS_NCASE:=$(shell uname -s | tr &#39;[A-Z]&#39; &#39;[a-z]&#39;)<br>&gt;&gt; <br>&gt;&gt; # Source and Build DIR&#39;s<br>&gt;&gt; BLENDER_DIR:=$(shell pwd -P)<br>&gt;&gt; BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)<br>
&gt;&gt; <br>&gt;&gt; # Get the number of cores for threaded build<br>&gt;&gt; NPROCS:=1<br>&gt;&gt; ifeq ($(OS), Linux)<br>&gt;&gt;     NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)<br>&gt;&gt; endif<br>&gt;&gt; ifeq ($(OS), Darwin)<br>
&gt;&gt;     NPROCS:=$(shell system_profiler | awk &#39;/Number Of CPUs/{print $4}{next;}&#39;)<br>&gt;&gt; endif<br>&gt;&gt; ifeq ($(OS), FreeBSD)<br>&gt;&gt;     NPROCS:=$(shell sysctl -a | grep &quot;hw.ncpu &quot; | cut -d&quot; &quot; -f3 )<br>
&gt;&gt; endif<br>&gt;&gt; ifeq ($(OS), NetBSD)<br>&gt;&gt;     NPROCS:=$(shell sysctl -a | grep &quot;hw.ncpu &quot; | cut -d&quot; &quot; -f3 )<br>&gt;&gt; endif<br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; # Build Blender<br>
&gt;&gt; all:<br>&gt;&gt;     @echo<br>&gt;&gt;     @echo Configuring Blender ...<br>&gt;&gt; <br>&gt;&gt;     if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \<br>&gt;&gt;         mkdir -p $(BUILD_DIR) ; \<br>&gt;&gt;         cd $(BUILD_DIR) ; \<br>
&gt;&gt;         cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=Release ; \<br>&gt;&gt;     fi<br>&gt;&gt; <br>&gt;&gt;     @echo<br>&gt;&gt;     @echo Building Blender ...<br>&gt;&gt;     cd $(BUILD_DIR) ; make -s -j $(NPROCS)<br>
&gt;&gt;     @echo<br>&gt;&gt;     @echo run blender from &quot;$(BUILD_DIR)/bin/blender&quot;<br>&gt;&gt;     @echo<br>&gt;&gt; <br>&gt;&gt; .PHONY: all<br>&gt;&gt; <br>&gt;&gt; # ------------<br>&gt;&gt; <br>&gt;&gt; - Campbell<br>
&gt; <br>&gt; _______________________________________________<br>&gt; Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>&gt; <br>&gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
&gt; <br>&gt; Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>&gt; <br>&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></div>