<div>hi</div><div> </div><div>I&#39;m trying to create a CMake build environment for a medium sized application. The application is getting ported to several plataforms and I would like to have just one build environment.</div>
<div> </div><div>The host plataform is WinVista/Linux. The first target plataform I&#39;m trying to create a build for is PSP. PSP have a toolchain (PSPSDK) which is based in GNU tools. I&#39;m trying to write a new toolchain file for using the PSPSDK.</div>
<div> </div><div>-----------------------------PSPSDK-Toolchain.cmake-----------------------------</div><div># the name of the host operating system<br>SET(CMAKE_SYSTEM_NAME &quot;Generic&quot;)</div><div> </div><div># here the target toolchain is located for cross compilation<br>
SET( CMAKE_FIND_ROOT_PATH &quot;C:\\pspsdk\\bin&quot; )</div><div> </div><div># which compilers to use for C and C++<br>SET( CMAKE_C_COMPILER psp-gcc )<br>SET( CMAKE_CXX_COMPILER psp-g++ )<br>SET( CMAKE_MAKE_PROGRAM make )<br>
SET( CMAKE_RC_COMPILER psp-ar )</div><div>-----------------------------PSPSDK-Toolchain.cmake-----------------------------</div><div> </div><div>It seems that CMake can find the psp-gcc and psp-g++ but the configure process fails because it cannot find some basic libraries needed.</div>
<div> </div><div>The log of the configure process is:</div><div> </div><div>----------------------------------------------------------------------------------------------</div><div>The C compiler identification is GNU
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;">The CXX compiler identification is GNU</p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;">Check for working C compiler: C:/pspsdk/bin/psp-gcc.exe</p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;">Check for working C compiler: C:/pspsdk/bin/psp-gcc.exe -- broken</p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  The C compiler &quot;C:/pspsdk/bin/psp-gcc.exe&quot; is not able to compile a simple</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  test program.</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  It fails with the following output:</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">   Change Dir: C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  </span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  Run Build Command:C:/FPC/2.4.0/bin/i386-win32/make.exe</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  &quot;cmTryCompileExec/fast&quot;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  C:/FPC/2.4.0/bin/i386-win32/make.exe -f</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  CMakeFiles/cmTryCompileExec.dir/build.make</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  CMakeFiles/cmTryCompileExec.dir/build</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  make.exe[1]: Entering directory</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  `C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  &quot;C:/Program Files/CMake 2.8/bin/cmake.exe&quot; -E cmake_progress_report</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp/CMakeFiles</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  1</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  &quot;Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj&quot;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  C:/pspsdk/bin/psp-gcc.exe -o</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj -c</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp/testCCompiler.c</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  &quot;Linking C executable cmTryCompileExec&quot;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  C:/pspsdk/bin/psp-gcc.exe</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  &quot;CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj&quot; -o cmTryCompileExec </span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  c:/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o: In function</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  `_start&#39;:</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  ../../../../pspsdk/src/startup/crt0.c:149: undefined reference to</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  `sceKernelCreateThread&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  ../../../../pspsdk/src/startup/crt0.c:150: undefined reference to</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  `sceKernelStartThread&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  c:/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o: In function</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  `_main&#39;:</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  ../../../../pspsdk/src/startup/crt0.c:68: undefined reference to `strlen&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  ../../../../pspsdk/src/startup/crt0.c:83: undefined reference to `atexit&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  ../../../../pspsdk/src/startup/crt0.c:89: undefined reference to `exit&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  collect2: ld returned 1 exit status</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  make.exe[1]: *** [cmTryCompileExec] Error 1</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  make.exe[1]: Leaving directory</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  `C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp&#39;</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  make.exe: *** [cmTryCompileExec/fast] Error 2</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  </span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  </span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  CMake will not be able to correctly generate this project.</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">Call Stack (most recent call first):</span></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;"><span style="color: rgb(255, 0, 0);">  CMakeLists.txt:9 (project)</span></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; color: rgb(255, 0, 0); text-indent: 0px; -qt-block-indent: 0; -qt-paragraph-type: empty;"></p>
<p style="margin: 0px; text-indent: 0px; -qt-block-indent: 0;">Configuring incomplete, errors occurred!</p></div><div>----------------------------------------------------------------------------------------------</div><div>
 </div><div>It is clear that it can find the compiler but cannot find the libraries...some are common C functions (strlen, etc); other are PSP specific (<font color="#000000">sceKernelCreateThread, etc).</font> How can I ask CMake to link some libraries to every executable which is using this particular toolchain? Will I have to manually set in CMakeLists.txt </div>
<div> </div><div> </div><div>Also, it is using the wrong make.exe program (is there a variable where I can force it to use a specific make)?</div><div> </div><div><br>-- </div><div>Daniel<br><br>&quot;Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.&quot; (Donald Knuth)<br>
<br>&quot;Yes, technogeeks can be funny, even if only to each other.&quot; (<a href="http://www.boogieonline.com/revolution/science/humor/">http://www.boogieonline.com/revolution/science/humor/</a>)&quot;<br><br>&quot;Man is driven to create; I know I really love to create things. And while I&#39;m not good at painting, drawing, or music, I can write software.&quot; (Yukihiro Matsumoto, a.k.a. ``Matz&#39;&#39;)<br>

</div>