diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-08-28 15:19:55 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-08-28 15:21:58 +0200 |
| commit | d11c412f953774bf5b0747815c67f6b6e759d4c8 (patch) | |
| tree | 09d2e98c3cd00d7195d65629cb330107e48336c4 | |
| parent | b328c1f90257e21f1fa2883dd7f18b22fd61592e (diff) | |
CMake: Make compile definitions 'FL_LIBRARY' and 'FL_DLL' private
... so they are not inherited by consumers of the library.
Remove 'add_definitions(-DFL_LIBRARY)' from src/CMakeLists.txt
This is not necessary, see CMake/fl_add_library.cmake
Don't set obsolete property 'CLEAN_DIRECT_OUTPUT' which was removed
in CMake 2.8.0.
| -rw-r--r-- | CMake/fl_add_library.cmake | 20 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 2 |
2 files changed, 9 insertions, 13 deletions
diff --git a/CMake/fl_add_library.cmake b/CMake/fl_add_library.cmake index b0fafbe32..ee7956560 100644 --- a/CMake/fl_add_library.cmake +++ b/CMake/fl_add_library.cmake @@ -37,13 +37,13 @@ macro (FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES) add_library(${TARGET_NAME} ${LIBTYPE} ${LIBFILES}) - # target properties for all libraries + # Target properties for all libraries - set_target_properties(${TARGET_NAME} - PROPERTIES - CLEAN_DIRECT_OUTPUT TRUE - COMPILE_DEFINITIONS "FL_LIBRARY" - ) + # Set 'PRIVATE' target compile definitions for the library + # so they are not inherited by consumers + + target_compile_definitions(${TARGET_NAME} + PRIVATE "FL_LIBRARY") # additional target properties for static libraries @@ -105,11 +105,9 @@ macro (FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES) endif (OPTION_LARGE_FILE) if (${LIBTYPE} STREQUAL "SHARED") - set_target_properties(${TARGET_NAME} - PROPERTIES - COMPILE_DEFINITIONS "FL_DLL" - ) - endif (${LIBTYPE} STREQUAL "SHARED") + target_compile_definitions(${TARGET_NAME} + PRIVATE "FL_DLL") + endif () endif (MSVC) install (TARGETS ${TARGET_NAME} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 681aac2cd..9f1a578b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -580,8 +580,6 @@ if (WIN32) list (APPEND STATIC_FILES fl_call_main.c) endif (WIN32) -add_definitions(-DFL_LIBRARY) - ####################################################################### # prepare optional libs for shared and static FLTK libraries |
