OpenClonk
C4ForbidLibraryCompilation.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2016, The OpenClonk Team and contributors
5  *
6  * Distributed under the terms of the ISC license; see accompanying file
7  * "COPYING" for details.
8  *
9  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
10  * See accompanying file "TRADEMARK" for details.
11  *
12  * To redistribute this file separately, substitute the full license texts
13  * for the above references.
14  */
15 
16 /*
17  * This file serves as a quick way to check wither COMPILED_AS_C4LIBRARY is set, which is the case when compiling lib{misc,c4script}
18  * This file should be included when the USE_CONSOLE define is checked. In the past, we had some header files with classes like
19 class Foo {
20 #ifndef USE_CONSOLE
21  int bar;
22 #endif
23  int blubb;
24 }
25  * If such a header was included in the library, the class definition would look different for the library than for the openclonk-server, which could be potentially desasterous. (just think of accessing blubb, or destructors, or copying it by size, or…)
26 */
27 
28 #ifdef COMPILED_AS_C4LIBRARY // as (hopefully) defined in the CMakeLists.txt
29 #error A file that is marked as not suitable for being included in lib{misc,c4script} (probably because it checks USE_CONSOLE) has been included in their compilation. Check your header dependencies.
30 #endif