Make everything work in cmake 3.8

This commit is contained in:
Davis King 2023-03-23 20:07:48 -04:00
parent b7834324b4
commit 806b629035
2 changed files with 16 additions and 4 deletions

View File

@ -184,7 +184,11 @@ if (CMAKE_COMPILER_IS_GNUCXX)
# definitely heap allocated.
add_compile_options(-Wno-free-nonheap-object)
endif()
if(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
# strip debug symbols to make the binary smaller
target_link_options(${target_name} PRIVATE $<$<CONFIG:RELEASE>:-s>)
endif()
elseif (MSVC)
# Treat warnings as errors.
@ -194,8 +198,12 @@ else() # basically Clang
add_compile_options(-W -Werror)
# This is for the comment in face_detection_ex.cpp that says "faces/*.jpg"
add_compile_options(-Wno-comment)
if(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
# strip debug symbols to make the binary smaller
target_link_options(${target_name} PRIVATE $<$<CONFIG:RELEASE>:-s>)
endif()
endif()
target_link_libraries(${target_name} dlib::dlib )

View File

@ -106,8 +106,12 @@ target_link_libraries(assignment_learning_ex dlib::dlib)
macro(add_example name)
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} dlib::dlib )
# And strip symbols to make your binary smaller if you like. Certainly not required though.
if(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
# And strip symbols to make your binary smaller if you like. Certainly not
# required though.
target_link_options(${name} PRIVATE $<$<CONFIG:RELEASE>:-s>)
endif()
endmacro()
# if an example requires GUI, call this macro to check DLIB_NO_GUI_SUPPORT to include or exclude