[CMake] CMake without C/C++ tests

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Mon Jan 31 08:13:21 EST 2011


I was quite sure that you  need your project to use at least one language, but that it does not need to be C/C++.

If you have issues with the internal test then a special TOOLCHAIN file is the way to go. I had to do this for a special fortran compiler that only built 32bit packages on a 64bit system. If memory servers me well you just need to put
INCLUDE(CMakeForceCompiler)
in your toolchain file.

Cheers,
Yngve

On Monday, January 31, 2011 11:59:11 AM Дима wrote:
> So, I put the line
> project (astl "NONE")
> in CmakeLists.txt
> 
> But it does not work, i got these messages
> $ cmake -DCMAKE_TOOLCHAIN_FILE=/home/Void/devel/svnroot/trunk/gcc/libstdc++-v3/astl/ToolchainFile.cmake /home/Void/devel/svnroot/trunk/gcc/libstdc++-v3/astl/
> -- Configuring done
> CMake Error: Cannot determine link language for target "astl".
> CMake Error: CMake can not determine linker language for target:astl
> -- Generating done
> -- Build files have been written to: /home/Void/devel/svnroot/trunk/gcc/libstdc++-v3/astl
> void at Impedance-Pad-T410:/home/Void/devel/build-astl$
> 
> Then i googled this http://www.cmake.org/pipermail/cmake/2006-July/010380.html
> and add SET_TARGET_PROPERTIES(astl PROPERTIES LINKER_LANGUAGE CXX) to CMakeLists.txt
> And got these
> CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
> Missing variable is:
> CMAKE_CXX_CREATE_STATIC_LIBRARY
> 
> 
> After it I add 
> SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_CXX_COMPILER> -o <TARGET> <OBJECTS>")
> in my CmakeLists.txt
> 
> 
> And finally, after cmake command, i got these
> 
> void at Impedance-Pad-T410:/home/Void/devel/build-astl$ make
> Scanning dependencies of target astl
> Linking CXX static library libastl.a                                                                                                    
> Error running link command: No such file or directory                                                                                   
> make[2]: *** [libastl.a] Error 2
> make[1]: *** [CMakeFiles/astl.dir/all] Error 2
> make: *** [all] Error 2
> void at Impedance-Pad-T410:/home/Void/devel/build-astl$ 
> 
> 
> Also, i can not compile project with standard gcc due to 
> project (astl "NONE")
> 
> 
> So, how can I remove -rdynamic option? Is it possible?
> 
> 
> 28.01.2011, 20:20, "Eric Noulard" <eric.noulard at gmail.com>:
> > 2011/1/28 Дима <Dimanne at yandex.ru>;:
> >
> >>  How can I change or disable C/C++ testing during cmake command?
> >
> > project(YourProject NONE)
> >
> > from the doc;
> >
> > Set a name for the entire project.
> >
> >          project(<projectname> [languageName1 languageName2 ... ] )
> >
> >         Sets the name of the project.  Additionally this sets the variables
> >        <projectName>_BINARY_DIR and <projectName>_SOURCE_DIR to the
> >        respective values.
> >
> >        Optionally you can specify which languages your project supports.
> >        Example languages are CXX (i.e.  C++), C, Fortran, etc.  By default C
> >        and CXX are enabled.  E.g.  if you do not have a C++ compiler, you can
> >        disable the check for it by explicitly listing the languages you want
> >        to support, e.g.  C.  By using the special language "NONE" all checks
> >        for any language can be disabled.
> >
> >>  PS CMake tries to compile with -rdynamic option, but our port of gcc does
> >>  not support it yet.
> >
> > Then may be you should set up a specific compiler ID.
> >
> > --
> > Erk
> > Membre de l'April - « promouvoir et défendre le logiciel libre » -
> > http://www.april.org
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list