You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example the unity is include like this: #include "unity.h", but Cmake installs the headers to /usr/local/include/unity/unity.h, so in my case it works with this include #include unity/unity.h
The text was updated successfully, but these errors were encountered:
Just fix include path to your compiler (the -I flag)... Much easier than going around modifying all the header files to include a subdirectory only you have...
In the example the unity is include like this: #include "unity.h", but Cmake installs the headers to /usr/local/include/unity/unity.h, so in my case it works with this include #include unity/unity.h
If you are using CMake, you can include directories so that the compiler (and Clion if you are using it as your IDE) recognizes the headers in those directories. There are two options in CMake for including header file directories:
Use include_directories: This command adds the header files to all of your targets. The compilation command will use -I[dir_you_include] for all of your targets. Here is an example:
include_directories("Unity/src")
Note that in my example, the Unity library and the CMake file are in the same directory.
Use target_include_directories: This option does the same thing but only includes the directories for a specific target. For example:
target_include_directories(myTarget "Unity/src")
This can be used in cases where you only want to include Unity for specific test modules, rather than including it for the entire project.
In the example the unity is include like this:
#include "unity.h"
, but Cmake installs the headers to/usr/local/include/unity/unity.h
, so in my case it works with this include#include unity/unity.h
The text was updated successfully, but these errors were encountered: