<div dir="ltr">Hello,<div><br></div><div>I'm trying to create a simple exercise, a definition for a virtual language "X" that will be used side-by-side with C and C++. </div><div>There are some restrictions on the level of compatibility with C/C++. For instance, the objects of this language aren't directly compatible with C and C++ but then there is a virtual application "X linker/librarian" that is capable of converting X objects into C objects generating a standard C lib (note the absence of a temporary objects in the C format, this is important).<br></div><div><br></div><div>Now, the project is composed of a subproject of type language X, that generate a lib, another subproject that generate another lib (a C one) and then the base project that should link libc with libx to create an executable.</div><div><br></div><div>proj/libx/CMakeLists.txt -> define: project(libx X) -> generate prefixlibx.a<br></div><div>proj/libc/CMakeLists.txt -> define: project(libc C) -> generate libc.a<br></div><div>proj/app/CMakeLists.txt -> define: project(app C) -> generate exec.elf that links libc.a and prefixlibx.a</div><div><br></div><div>Everything _almost_ work the way I want, with exception of the librarian/linker.</div><div>If I force in CMakeDetermineXCompiler.cmake the CMAKE_AR to "xar" and "xranlib", it will use then to do the libx AND libc.</div><div>If I do not force CMAKE_AR and let find_program determine, it will use "ar" for both libc AND libx.</div><div><br></div><div>Why can't I use CMAKE_AR as "xar" inside a X project that is inside a C project?</div><div><br></div><div>I think that if something like CMAKE_<LANG>_AR and others existed, we would be able to do more complex things for example (enabling the use of < > variables).</div><div><br></div><div>All this is only hypothetical and I'm using this to understand better CMake and try to map how I can _implement_ _new_ languages and toolsets to use with our custom tools.</div><div><br></div><div>Here is a link to my repository where I added this cmake test: <a href="https://github.com/fungos/cmake_langx">https://github.com/fungos/cmake_langx</a></div><div><br></div><div>Thank you</div><div>Danny Grein</div><div><br></div><div><br></div><div><br></div></div>