Switching to CMake;#14
Conversation
| message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} OS detected - currently not supported - EXIT") | ||
| endif() | ||
|
|
||
| include_directories(nav) |
There was a problem hiding this comment.
I suggest using target_include_directories() instead.
There was a problem hiding this comment.
ok.
would lead to something like this, or?
cmake_minimum_required(VERSION 3.19.0)
project(NCOM2CSV)
if(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
message("Apple OS (Darwin) detected")
elseif(${CMAKE_SYSTEM_NAME} MATCHES Linux)
message("Linux OS detected")
else()
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} OS detected - currently not supported - EXIT")
endif()
set(SOURCES nav/NComRxC.c example/NcomToCsv.c)
add_executable(ncom2csv ${SOURCES})
target_include_directories(ncom2csv PRIVATE nav)
| endif() | ||
|
|
||
| include_directories(nav) | ||
| set(SOURCES nav/NComRxC.c example/NcomToCsv.c) |
There was a problem hiding this comment.
I suggest listing header files as well for the sake of completeness and explicitness. Despite this is not really necessary to build the code, some IDEs benefit from that.
There was a problem hiding this comment.
well, pointing to a directory instead of single files would keep the script - slightly - leaner and easier to maintain. So I'd propose just to mention the include directory by using the suggested target_include_directories().
There was a problem hiding this comment.
Any of the suggested approaches will allow to build the code. This is more about convenience with regards to personal habbits and tools used by active contributors. So, they are the ones to decide.
Basically, the trade-off is whether one wants less writing CMakeLists or have more robust setup with regards to tooling like IDEs and Git in terms of active switching between branches.
Up to you.
switching to cmake in order to focus on supported OSs