I am quite new to the whole CMake logic and syntax. For the code I am working on, I need to use the cap_set_proc function to work with a process capabilities flags (man link). So I decided to start with a really stupid piece of code that you see here:
#include<iostream> #include<string> #include<sys/capability.h> using namespace std; int main(){ cap_t test = cap_get_proc(); string whatsTest(cap_to_text(test,nullptr)); cout<<whatsTest<<endl; return 0; } (For the moment, I do not care if the code I wrote makes any sense...)
Now, if I simply use c++ (as shown below) everything compiles fine and the executable runs without any issue:
c++ test_main.cpp -o test_cap -lcap The problem is that the project I am working one is pretty huge and relies on CMake pretty heavily. So I wanted to compile the same code but using CMake... How do I write a CMakeLists.txt file that allows me to obtain the same result as the compiler instruction shown in the previous lines?