cmake : make -Wmissing-prototypes etc. match the Makefile

This commit is contained in:
Cebtenzzre 2023-09-15 15:49:24 -04:00
parent 7ddf185537
commit b52ce44afd
2 changed files with 11 additions and 2 deletions

View file

@ -434,8 +434,9 @@ if (LLAMA_ALL_WARNINGS)
-Wno-unused-function -Wno-unused-function
-Wno-multichar -Wno-multichar
) )
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang++ only
# g++ only set(cxx_flags ${cxx_flags} -Wmissing-prototypes)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # g++ only
set(cxx_flags ${cxx_flags} -Wno-format-truncation -Wno-array-bounds) set(cxx_flags ${cxx_flags} -Wno-format-truncation -Wno-array-bounds)
endif() endif()
else() else()

View file

@ -3,3 +3,11 @@ add_executable(${TARGET} train-text-from-scratch.cpp)
install(TARGETS ${TARGET} RUNTIME) install(TARGETS ${TARGET} RUNTIME)
target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PRIVATE cxx_std_11) target_compile_features(${TARGET} PRIVATE cxx_std_11)
# TODO(cebtenzzre): remove this once PR #2632 gets merged
if (NOT MSVC)
target_compile_options(${TARGET} PRIVATE -Wno-missing-declarations)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${TARGET} PRIVATE -Wno-missing-prototypes)
endif()