Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use CMAKE for a custom compiler and custom OS?

Tags:

c++

cmake

I want to use CMAKE for a project that is very big, written in C++. But this project is not using a "modern compiler" nor a popular compiler, and is for a unique OS that, for practical purposes, let say I made it so I have access to almost all of its source code (but I can't modify it, I only have modify access to my project). Lets call this OS, OSreally.

My project can be compiled Windows and can run in Windows and OSreally.

What I need to do to implement CMAKE for this project? So I can get all of the CMAKE "benefits".

like image 647
Gatito Avatar asked Oct 20 '25 05:10

Gatito


1 Answers

In a sense, your question isn't terribly hard to answer. CMake is extremely extensible, and almost everything can be changed. For example, to use your custom compiler, you could SET(CMAKE_CXX_COMPILER /path/to/compiler) in your top level build file. However, even though a few more hacks like this will get you on your way to compiling code for your strange OS, there may also be issues with various system functions and the standard library.

If no one has implemented the standard library on your OS, you may need to spend some time building it and possibly modifying it to fit with whatever is different on the system. The same goes for basically any library you would want to import. Regardless, if you have a conforming C++ compiler for the system, the proper path would be to simply set the above variable in your CMakeLists.txt and fix any problems that arise as you encounter them.

like image 117
Qwertycrackers Avatar answered Oct 22 '25 19:10

Qwertycrackers