-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added draft doc on CMake integration.
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
If your CMake project links to some library which you would like to replace with Implib.so wrapper: | ||
``` | ||
cmake_minimum_required(VERSION 3.21) | ||
project(prog) | ||
add_executable(prog prog.c) | ||
target_link_libraries(prog PRIVATE xcb) | ||
``` | ||
you just need to add a custom command to generate wrapper code and link against `libdl`: | ||
``` | ||
cmake_minimum_required(VERSION 3.21) | ||
project(prog) | ||
enable_language(ASM) | ||
add_custom_command( | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libxcb.so.tramp.S ${CMAKE_CURRENT_BINARY_DIR}/libxcb.so.init.c | ||
COMMAND implib-gen.py /usr/lib/x86_64-linux-gnu/libxcb.so | ||
DEPENDS /usr/lib/x86_64-linux-gnu/libxcb.so | ||
) | ||
add_executable(prog prog.c ${CMAKE_CURRENT_BINARY_DIR}/libxcb.so.tramp.S ${CMAKE_CURRENT_BINARY_DIR}/libxcb.so.init.c) | ||
target_link_libraries(prog PRIVATE dl) | ||
``` |