Re: [CMake] How can I create a C executable and C++ library from the same source

2018-01-17 Thread Robert Maynard
As stated CMake tracks source files globally so they can only have a single language. Project that I work on have migrated over to using file(GENERATE) to produce the files as it only requires a couple lines of CMake code. get_filename_component(c_fname "${c_source_file}" NAME_WE)

Re: [CMake] How can I create a C executable and C++ library from the same source

2018-01-17 Thread J Decker
No. CMake tracks each source file name exactly once. If you set properties on it, it will be treated that way always. Have to make a copy of the source to cpp... copies to cmake_binary_dir/ plusplus_file_dup is the resulting list ( https://github.com/d3x0r/SACK/blob/master/CMakeLists.txt#L655

Re: [CMake] How can I create a C executable and C++ library from the same source

2018-01-17 Thread Matthew Keeler
Whether what you want exactly is possible I dont know. If you are just wanting your C++ test library to be able to test your C source then I would still let them compile as C and just extern ā€œCā€ { #include }. When it gets linked all together it should be fine. This is how I usually do testing of

[CMake] How can I create a C executable and C++ library from the same source

2018-01-17 Thread Jimi Damon
Hi, I want to use Gtest for some unit tests on a number of the C functions that comprise my C executable. However, Gtest ( And gMock ) are C++ testing frameworks. What I would like to have is a project for my exe and then a separate project for my C++ library and be able to change the source