| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2016-05-06 10:14:47 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2016-05-06 10:14:47 +0200 |
| commit | 76fcc3b460d489cf8a1aad4be06b49d19bb138df (patch) | |
| tree | 6ac21c269b4e386fd5094bb6deb10618370b9df8 | |
| parent | ccbd0363f2be9a46152852a9d8c8b9f90be08373 (diff) | |
Makes the main CMakeLists.txt more portable.
The POSIX version was previously only set in files. Having it set at the
root level makes more sense, especially considering that the previous
method could make successful compilation of the project dependent on the
order in which files are compiled. Which obviously not acceptable.
Flags were also set in a way that made them potentially only compatible
with GNUCC. This is now fixed (the optimization flag remains GNUCC only,
but a check for which compiler is used precedes it).
| -rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ba70690..2df7e18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,18 @@ project("Zero of One") include(FindPkgConfig) add_subdirectory(src) -set(CMAKE_C_FLAGS "-D_POSIX_SOURCE -std=c99 -O2") +add_definitions(-D_POSIX_SOURCE) +add_definitions(-D_POSIX_C_SOURCE=200809L) + +if(CMAKE_COMPILER_IS_GNUCC) + message(STATUS "GNUCC detected. Adding '-02' parameter.") + set(CMAKE_C_FLAGS "-O2") +endif() + # ${SRC_FILES} is recursively defined in the subdirectories. # Each subdirectory only adds the source files that are present at its level. add_executable(zero_of_one ${SRC_FILES}) +set_property(TARGET zero_of_one PROPERTY C_STANDARD 99) +set_property(TARGET zero_of_one PROPERTY C_STANDARD_REQUIRED ON) +#find_package(Threads) +#target_link_libraries(cborg ${CMAKE_THREAD_LIBS_INIT}) |


