ref: e9405d3baf0642a1b52c02b69eb0b8783f3263d8
parent: 69dd169d736a6f84de3fd2cd59b50a5cc4527f54
author: Clifford Yapp <238416+starseeker@users.noreply.github.com>
date: Mon Jul 19 05:59:41 EDT 2021
Add compiler flags to CMake build
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,10 @@
LANGUAGES C
)
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+set(CMAKE_C_EXTENSIONS OFF)
+
# Set relative output directory paths, if not already defined
if (NOT BIN_DIR)
set(BIN_DIR bin)
--- a/SDL_Examples/CMakeLists.txt
+++ b/SDL_Examples/CMakeLists.txt
@@ -16,6 +16,9 @@
add_executable(${DEMO_NAME} ${DEMO}.c)
target_link_libraries(${DEMO_NAME} ${TINYGL_LIB} ${M_LIBRARY} ${SDL_LIBRARY})
target_include_directories(${DEMO_NAME} PUBLIC ${SDL_INCLUDE_DIR})
+ if(NOT MSVC)
+ target_compile_options(${DEMO_NAME} PRIVATE -O3 -DNDEBUG -pedantic -march=native -Wall)
+ endif(NOT MSVC)
endforeach()
set(TINYGL_RESOURCES
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,7 +36,7 @@
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
if(NOT MSVC)
- target_compile_options(tinygl PRIVATE "-Wall")
+ target_compile_options(tinygl PRIVATE -O3 -DNDEBUG -pedantic -march=native -Wall)
endif(NOT MSVC)
endif(TINYGL_BUILD_STATIC)
@@ -47,6 +47,9 @@
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
+ if(NOT MSVC)
+ target_compile_options(tinygl-static PRIVATE -O3 -DNDEBUG -pedantic -march=native -Wall)
+ endif(NOT MSVC)
endif(TINYGL_BUILD_STATIC)
# Local Variables: