Skip to content

Commit

Permalink
CMake: Set C_STANDARD locally
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Dec 26, 2023
1 parent 8b08dca commit 3126d51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

set(CMAKE_C_STANDARD 99)

add_library (primac cintrf.f90 cobyla_c.f90 lincoa_c.f90 bobyqa_c.f90 newuoa_c.f90 uobyqa_c.f90 prima.c)
if (WIN32)
set_target_properties(primac PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
Expand Down Expand Up @@ -30,6 +27,7 @@ macro (prima_add_c_test name)
add_executable (example_${name}_c_exe EXCLUDE_FROM_ALL examples/${name}/${name}_example.c)
target_link_libraries (example_${name}_c_exe PRIVATE primac)
target_include_directories (example_${name}_c_exe PRIVATE ${CMAKE_SOURCE_DIR}/c/include)
set_target_properties(example_${name}_c_exe PROPERTIES C_STANDARD 99)
if (PRIMA_ENABLE_EXAMPLES)
set_target_properties (example_${name}_c_exe PROPERTIES EXCLUDE_FROM_ALL FALSE)
endif ()
Expand Down
1 change: 1 addition & 0 deletions c/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

macro (prima_add_c_test_multi name)
add_executable(${name}_c_exe EXCLUDE_FROM_ALL ${name}.c)
set_target_properties(${name}_c_exe PROPERTIES C_STANDARD 99)
if (PRIMA_ENABLE_TESTING)
set_target_properties (${name}_c_exe PROPERTIES EXCLUDE_FROM_ALL FALSE)
endif ()
Expand Down

0 comments on commit 3126d51

Please sign in to comment.