Skip to content

Commit ccbff2c

Browse files
authored
Merge pull request #373 from qw-ctf/system-wide-q3asm
BUILD: Use system wide q3asm if found.
2 parents d2b6c5a + f1b3740 commit ccbff2c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,24 @@ else()
181181
endif()
182182

183183

184-
# Build QVM tools.
185-
# EXCLUDE_FROM_ALL tells to not build tools if they does not required, for example if you build native library only.
186-
add_subdirectory(tools/q3asm EXCLUDE_FROM_ALL)
184+
# Build QVM tools if needed.
185+
find_program(Q3ASM q3asm)
186+
if(Q3ASM)
187+
message(STATUS "q3asm found at ${Q3ASM}")
188+
set(QVM_LINKER "${Q3ASM}")
189+
else()
190+
message(STATUS "q3asm not found, compiling bundled q3asm.")
191+
# EXCLUDE_FROM_ALL tells to not build tools if they does not required, for example if you build native library only.
192+
add_subdirectory(tools/q3asm EXCLUDE_FROM_ALL)
193+
set(QVM_LINKER "q3asm")
194+
endif()
187195

188196
# Set up vars for QVM library.
189197
set(VM_DIR "vm")
190198
add_custom_target(vmdir
191199
COMMAND ${CMAKE_COMMAND} -E make_directory ${VM_DIR}
192200
)
193201
set(QVM_COMPILER "q3lcc")
194-
set(QVM_LINKER "q3asm")
195202
set(QVM_C_FLAGS -DQ3_VM -S -Wf-target=bytecode -Wf-g)
196203
if(BOT_SUPPORT)
197204
set(QVM_C_FLAGS ${QVM_C_FLAGS} -DBOT_SUPPORT=1)

0 commit comments

Comments
 (0)