From 17950dc47eebcc2537e4deae59d0c940c07e645d Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 16 Feb 2021 20:08:14 +0000 Subject: [PATCH] Rename library so lib isn't repeated on Linux --- CMakeLists.txt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a3ca83..b7173c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,9 +14,9 @@ set(EXE_C_SOURCE_FILES src/main.c src/pngio.c src/libs/argparse.c) set(LIB_C_HEADER_FILES src/apt.h) # Link with static library for aptdec executable, so we don't need to set the path -add_library(libaptdecstatic STATIC ${LIB_C_SOURCE_FILES}) +add_library(aptstatic STATIC ${LIB_C_SOURCE_FILES}) # Create shared library for 3rd party apps -add_library(libaptdec SHARED ${LIB_C_SOURCE_FILES}) +add_library(apt SHARED ${LIB_C_SOURCE_FILES}) add_compile_definitions(PALETTE_DIR="../palettes") @@ -26,7 +26,7 @@ if (PNG_FOUND AND LIBSNDFILE_FOUND) include_directories(${LIBSNDFILE_INCLUDE_DIR}) target_link_libraries(aptdec PRIVATE PNG::PNG) target_link_libraries(aptdec PRIVATE ${LIBSNDFILE_LIBRARY}) - target_link_libraries(aptdec PRIVATE libaptdecstatic) + target_link_libraries(aptdec PRIVATE aptstatic) if (MSVC) target_compile_options(aptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1 /DAPT_API_STATIC) else() @@ -41,20 +41,21 @@ if (PNG_FOUND AND LIBSNDFILE_FOUND) endif() endif() else() - MESSAGE(STATUS "WARNING: Only building libaptdec, as not all of the required libraries were found.") + MESSAGE(STATUS "WARNING: Only building apt library, as not all of the required libraries were found for aptdec.") endif() if (MSVC) - target_compile_options(libaptdec PRIVATE /D_CRT_SECURE_NO_WARNINGS=1 /DAPT_API_EXPORT) + target_compile_options(apt PRIVATE /D_CRT_SECURE_NO_WARNINGS=1 /DAPT_API_EXPORT) + target_compile_options(aptstatic PRIVATE /D_CRT_SECURE_NO_WARNINGS=1 /DAPT_API_STATIC) else() # Math - target_link_libraries(libaptdec PRIVATE m) - target_link_libraries(libaptdecstatic PRIVATE m) + target_link_libraries(apt PRIVATE m) + target_link_libraries(aptstatic PRIVATE m) if(CMAKE_BUILD_TYPE MATCHES "Release") - target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror) + target_compile_options(apt PRIVATE -Wall -Wextra -pedantic -Wno-missing-field-initializers -Werror) else() - target_compile_options(libaptdec PRIVATE -Wall -Wextra -pedantic) + target_compile_options(apt PRIVATE -Wall -Wextra -pedantic) endif() endif() @@ -79,7 +80,7 @@ IF(NOT WIN32) install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/") endif() - install(TARGETS libaptdec LIBRARY DESTINATION lib) + install(TARGETS apt LIBRARY DESTINATION lib) install(FILES ${LIB_C_HEADER_FILES} DESTINATION include/apt ) else() #set(CPACK_GENERATOR "ZIP;NSIS") @@ -91,7 +92,7 @@ else() file(GLOB_RECURSE DLLS *.dll) install(FILES ${DLLS} DESTINATION "bin/") endif() - install(TARGETS libaptdec DESTINATION "bin/") + install(TARGETS apt DESTINATION "bin/") install(FILES ${LIB_C_HEADER_FILES} DESTINATION include/apt ) install(DIRECTORY "${PROJECT_SOURCE_DIR}/palettes/" DESTINATION "palettes/") endif()