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.
This commit is contained in:
Albrecht Schlosser
2023-08-28 15:19:55 +02:00
parent b328c1f902
commit d11c412f95
2 changed files with 9 additions and 13 deletions
+9 -11
View File
@@ -37,13 +37,13 @@ macro (FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
add_library(${TARGET_NAME} ${LIBTYPE} ${LIBFILES}) add_library(${TARGET_NAME} ${LIBTYPE} ${LIBFILES})
# target properties for all libraries # Target properties for all libraries
set_target_properties(${TARGET_NAME} # Set 'PRIVATE' target compile definitions for the library
PROPERTIES # so they are not inherited by consumers
CLEAN_DIRECT_OUTPUT TRUE
COMPILE_DEFINITIONS "FL_LIBRARY" target_compile_definitions(${TARGET_NAME}
) PRIVATE "FL_LIBRARY")
# additional target properties for static libraries # additional target properties for static libraries
@@ -105,11 +105,9 @@ macro (FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
endif (OPTION_LARGE_FILE) endif (OPTION_LARGE_FILE)
if (${LIBTYPE} STREQUAL "SHARED") if (${LIBTYPE} STREQUAL "SHARED")
set_target_properties(${TARGET_NAME} target_compile_definitions(${TARGET_NAME}
PROPERTIES PRIVATE "FL_DLL")
COMPILE_DEFINITIONS "FL_DLL" endif ()
)
endif (${LIBTYPE} STREQUAL "SHARED")
endif (MSVC) endif (MSVC)
install (TARGETS ${TARGET_NAME} install (TARGETS ${TARGET_NAME}
-2
View File
@@ -580,8 +580,6 @@ if (WIN32)
list (APPEND STATIC_FILES fl_call_main.c) list (APPEND STATIC_FILES fl_call_main.c)
endif (WIN32) endif (WIN32)
add_definitions(-DFL_LIBRARY)
####################################################################### #######################################################################
# prepare optional libs for shared and static FLTK libraries # prepare optional libs for shared and static FLTK libraries