CMake: Make all target_compile_definitions private

It is only used to build scintilla, no need to expose these definitions to external projects.
This commit is contained in:
Maarten Bent
2022-04-10 19:35:15 +02:00
parent de495c19a3
commit affbbce1a3
3 changed files with 10 additions and 12 deletions

View File

@@ -500,18 +500,15 @@ macro(wx_lib_include_directories name)
endif()
endmacro()
# wx_lib_compile_definitions(name [])
# wx_lib_compile_definitions(name defs)
# Forwards everything to target_compile_definitions() except for monolithic
# build where it collects all definitions for linking with the mono lib
macro(wx_lib_compile_definitions name)
if(wxBUILD_MONOLITHIC)
cmake_parse_arguments(_LIB_DEFINITIONS "" "" "PUBLIC;PRIVATE" ${ARGN})
list(APPEND wxMONO_DEFINITIONS_PUBLIC ${_LIB_DEFINITIONS_PUBLIC})
list(APPEND wxMONO_DEFINITIONS_PRIVATE ${_LIB_DEFINITIONS_PRIVATE})
set(wxMONO_DEFINITIONS_PUBLIC ${wxMONO_DEFINITIONS_PUBLIC} PARENT_SCOPE)
set(wxMONO_DEFINITIONS_PRIVATE ${wxMONO_DEFINITIONS_PRIVATE} PARENT_SCOPE)
list(APPEND wxMONO_DEFINITIONS ${ARGN})
set(wxMONO_DEFINITIONS ${wxMONO_DEFINITIONS} PARENT_SCOPE)
else()
target_compile_definitions(${name};${ARGN})
target_compile_definitions(${name} PRIVATE ${ARGN})
endif()
endmacro()

View File

@@ -15,6 +15,7 @@ if(wxBUILD_MONOLITHIC)
set(wxMONO_LIBS_PRIVATE)
set(wxMONO_LIBS_PUBLIC)
set(wxMONO_INCLUDE_DIRS)
set(wxMONO_DEFINITIONS)
set(wxMONO_NONCOMPILED_CPP_FILES)
endif()
@@ -84,13 +85,13 @@ if(wxBUILD_MONOLITHIC)
target_link_libraries(wxmono ${vis} ${wxMONO_LIBS_${vis}})
endif()
if(wxMONO_DEFINITIONS_${vis})
target_compile_definitions(wxmono ${vis} ${wxMONO_DEFINITIONS_${vis}})
endif()
endforeach()
if(wxMONO_INCLUDE_DIRS)
target_include_directories(wxmono BEFORE PRIVATE ${wxMONO_INCLUDE_DIRS})
endif()
if(wxMONO_DEFINITIONS)
target_compile_definitions(wxmono PRIVATE ${wxMONO_DEFINITIONS})
endif()
foreach(file ${wxMONO_NONCOMPILED_CPP_FILES})
set_source_files_properties(${file} PROPERTIES HEADER_FILE_ONLY TRUE)
endforeach()

View File

@@ -164,7 +164,7 @@ target_include_directories(wxscintilla PRIVATE
${wxSOURCE_DIR}/src/stc/scintilla/lexlib
${wxSOURCE_DIR}/src/stc/scintilla/src
)
target_compile_definitions(wxscintilla PUBLIC
target_compile_definitions(wxscintilla PRIVATE
NO_CXX11_REGEX
__WX__
SCI_LEXER
@@ -188,7 +188,7 @@ wx_lib_include_directories(wxstc
${wxSOURCE_DIR}/src/stc/scintilla/lexlib
${wxSOURCE_DIR}/src/stc/scintilla/src
)
wx_lib_compile_definitions(wxstc PRIVATE
wx_lib_compile_definitions(wxstc
NO_CXX11_REGEX
__WX__
SCI_LEXER