Skip to content

Commit bd8e848

Browse files
committed
Automatically set right executable properties for windows
In case the `editbin` executable is available automatically set the right properties of the created executables. For de bugging purposes it might be useful to have the `doxywizard` not as a "windows" type of executable but as "console" executable, this can be accomplished by means of the setting of `enable_console=ON`. The `enable_console` only operates on the `doxywizard` executable. Usage like: `cmake -Denable_console=ON ..`
1 parent a1edc03 commit bd8e848

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ option(use_libclang "Add support for libclang parsing." OFF)
2929
option(static_libclang "Link to a statically compiled version of LLVM/libclang." OFF)
3030
option(win_static "Link with /MT in stead of /MD on windows" OFF)
3131
option(english_only "Only compile in support for the English language" OFF)
32+
option(enable_console "Enable that excutables on Windows get the CONSOLE bit set for the doxywizard executable [development]" OFF)
3233
option(enable_coverage "Enable coverage reporting for gcc/clang [development]" OFF)
3334

3435
set(force_qt CACHE INTERNAL "Forces doxywizard to build using the specified major version, this can be Qt5 or Qt6")
@@ -80,6 +81,18 @@ if (CMAKE_SYSTEM MATCHES "Darwin")
8081
set(EXTRA_LIBS ${CORESERVICES_LIB})
8182
endif()
8283

84+
find_program(EDITBIN editbin)
85+
if(EDITBIN)
86+
set(EDITBIN_FLAGS /nologo /OSVERSION:5.1)
87+
if (enable_console)
88+
set(EDITBIN_FLAGS ${EDITBIN_FLAGS} /SUBSYSTEM:CONSOLE,6.00)
89+
set(EDITBIN_WIZARD_FLAGS ${EDITBIN_FLAGS})
90+
else()
91+
set(EDITBIN_WIZARD_FLAGS ${EDITBIN_FLAGS} /SUBSYSTEM:WINDOWS,6.00)
92+
set(EDITBIN_FLAGS ${EDITBIN_FLAGS} /SUBSYSTEM:CONSOLE,6.00)
93+
endif()
94+
endif()
95+
8396
if (WIN32)
8497
if ((NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") AND
8598
(NOT CMAKE_GENERATOR MATCHES "MSYS Makefiles") AND

addon/doxyapp/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ include_directories(
1111
add_executable(doxyapp
1212
doxyapp.cpp
1313
)
14+
if(EDITBIN)
15+
add_custom_command(
16+
TARGET doxyapp
17+
POST_BUILD
18+
COMMAND "${EDITBIN}" ${EDITBIN_FLAGS} "$<TARGET_FILE:doxyapp>"
19+
VERBATIM)
20+
endif()
21+
1422
add_sanitizers(doxyapp)
1523

1624
if (use_libclang)

addon/doxyparse/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ include_directories(
1111
add_executable(doxyparse
1212
doxyparse.cpp
1313
)
14+
if(EDITBIN)
15+
add_custom_command(
16+
TARGET doxyparse
17+
POST_BUILD
18+
COMMAND "${EDITBIN}" ${EDITBIN_FLAGS} "$<TARGET_FILE:doxyparse>"
19+
VERBATIM)
20+
endif()
1421
add_sanitizers(doxyparse)
1522

1623
if (use_libclang)

addon/doxysearch/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ include_directories(
1414
add_executable(doxyindexer
1515
doxyindexer.cpp
1616
)
17+
if(EDITBIN)
18+
add_custom_command(
19+
TARGET doxyindexer
20+
POST_BUILD
21+
COMMAND "${EDITBIN}" ${EDITBIN_FLAGS} "$<TARGET_FILE:doxyindexer>"
22+
VERBATIM)
23+
endif()
1724
target_link_libraries(doxyindexer
1825
${XAPIAN_LIBRARIES}
1926
${ZLIB_LIBRARIES}
@@ -26,6 +33,13 @@ target_link_libraries(doxyindexer
2633
add_executable(doxysearch.cgi
2734
doxysearch.cpp
2835
)
36+
if(EDITBIN)
37+
add_custom_command(
38+
TARGET doxysearch.cgi
39+
POST_BUILD
40+
COMMAND "${EDITBIN}" ${EDITBIN_FLAGS} "$<TARGET_FILE:doxysearch.cgi>"
41+
VERBATIM)
42+
endif()
2943
target_link_libraries(doxysearch.cgi
3044
doxygen_version
3145
${XAPIAN_LIBRARIES}

addon/doxywizard/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ doxywizard.rc
124124

125125
set_property(TARGET doxywizard PROPERTY WIN32_EXECUTABLE true)
126126

127+
if(EDITBIN)
128+
add_custom_command(
129+
TARGET doxywizard
130+
POST_BUILD
131+
COMMAND "${EDITBIN}" ${EDITBIN_WIZARD_FLAGS} "$<TARGET_FILE:doxywizard>"
132+
VERBATIM)
133+
endif()
134+
127135
if(Qt5Core_FOUND)
128136
target_link_libraries(doxywizard Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml doxygen_version)
129137
else()

src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ endif()
327327
add_executable(doxygen
328328
main.cpp
329329
)
330+
if(EDITBIN)
331+
add_custom_command(
332+
TARGET doxygen
333+
POST_BUILD
334+
COMMAND "${EDITBIN}" ${EDITBIN_FLAGS} "$<TARGET_FILE:doxygen>"
335+
VERBATIM)
336+
endif()
330337
add_sanitizers(doxygen)
331338

332339
if (use_libclang)

0 commit comments

Comments
 (0)