Browse Source

Use INCLUDE_DIRs for libraries. Simplify conditions

tags/v1.8.0
Jon Beniston 3 years ago
parent
commit
4aca94f20f
1 changed files with 12 additions and 7 deletions
  1. +12
    -7
      CMakeLists.txt

+ 12
- 7
CMakeLists.txt View File

@@ -19,10 +19,14 @@ add_compile_definitions(PALETTE_DIR="../palettes")


if (PNG_FOUND AND LIBSNDFILE_FOUND) if (PNG_FOUND AND LIBSNDFILE_FOUND)
add_executable(aptdec ${EXE_C_SOURCE_FILES}) add_executable(aptdec ${EXE_C_SOURCE_FILES})
target_link_libraries(aptdec PRIVATE libaptdec)
include_directories(${PNG_PNG_INCLUDE_DIR})
include_directories(${LIBSNDFILE_INCLUDE_DIR})
target_link_libraries(aptdec PRIVATE PNG::PNG) target_link_libraries(aptdec PRIVATE PNG::PNG)
target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY}) target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY})
if (CLANG OR GCC)
target_link_libraries(aptdec PRIVATE libaptdec)
if (MSVC)
target_compile_options(aptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
else()
# Math # Math
target_link_libraries(aptdec PRIVATE m) target_link_libraries(aptdec PRIVATE m)


@@ -32,21 +36,22 @@ if (PNG_FOUND AND LIBSNDFILE_FOUND)
else() else()
target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic) target_compile_options(aptdec PRIVATE -Wall -Wextra -pedantic)
endif() endif()
elseif (MSVC)
target_compile_options(aptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
endif() endif()
else() else()
MESSAGE(STATUS "WARNING: Only building libaptdec, as not all of the required libraries were found.") MESSAGE(STATUS "WARNING: Only building libaptdec, as not all of the required libraries were found.")
endif() endif()


if (CLANG OR CGCC)
if (MSVC)
target_compile_options(libaptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
else()
# Math
target_link_libraries(libaptdec PRIVATE m)

if(CMAKE_BUILD_TYPE MATCHES "Release") if(CMAKE_BUILD_TYPE MATCHES "Release")
target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror) target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror)
else() else()
target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic) target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic)
endif() endif()
elseif (MSVC)
target_compile_options(libaptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1)
endif() endif()


# TODO: get this from git # TODO: get this from git


Loading…
Cancel
Save