Adding GCC -include compiler flag

684 views
Skip to first unread message

Jeff Brydle

unread,
Jul 19, 2023, 4:44:34 PM7/19/23
to ThrowTheSwitch Forums

Hi,

We have generated a unit_test_support.h header file to include in our embedded project to utilize some Ceedling/Unity workarounds while not changing the structure of the source under test:

#ifndef UNIT_TEST_SUPPORT_H_

#define UNIT_TEST_SUPPORT_H_

 

// redefined static and assert for unit tests

#ifndef TEST

#define STATIC    static

#define FOREVER() 1

#else

#define STATIC

int NumLoops = 0x00;

#define FOREVER() NumLoops--

#undef assert

#include "CException.h"

#define assert(condition) \

    if (!(condition))     \

    Throw(0)

#endif

#endif

 Rather than having to #include this header file in each source code C file, we would like to preinclude it when compiling all files.  This is simple to do in our IDE when compiling the SUT.  However, we can’t figure out how do add this functionality in the Ceedling environment.  We think that the GCC flag we want to add is -include file.  How do we add the -include option when the GCC compiler is called during a Ceedling unit test without invalidating the existing compiler flags/options?

Thanks in advance for your assistance.

Christian Cortes

unread,
Sep 27, 2023, 1:36:45 PM9/27/23
to ThrowTheSwitch Forums
under 
:paths:
  :source:              #together the following comprise all source search paths
    - project/source/*  #expansion yields all subdirectories of depth 1 plus parent directory
    - project/lib       #single path
  :test:                #all test search paths
    - project/**/test?  #expansion yields any subdirectory found anywhere in the project that
                        #begins with "test" and contains 5 characters
  :include:
you can add an :include: and add the path to include paths there. 
Reply all
Reply to author
Forward
0 new messages