Skip to content

Update cmake integration #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ IDL is used for creating COM servers. Unfortunately CMake has a limited support
- Tlbimp.exe (optional)

# Usage
## find_package()
Add [FindIDL](https://github.com/apriorit/FindIDL) to the module search path and call `find_package`:
## Simplest integration
```cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
find_package(IDL REQUIRED)
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/FindIDL.cmake")
message(STATUS "Downloading FindIDL.cmake from https://github.com/apriorit/FindIDL")
file(DOWNLOAD "https://raw.githubusercontent.com/apriorit/FindIDL/1.0.2/cmake/FindIDL.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/FindIDL.cmake"
EXPECTED_HASH SHA256=d88db93c485227b287371bd1848d82110fa5ef32e5febe6865aa3ec27c7558b3
TLS_VERIFY ON)
endif()

include(${CMAKE_CURRENT_BINARY_DIR}/FindIDL.cmake)
```
[FindIDL](https://github.com/apriorit/FindIDL) will search for midl.exe and tlbimp.exe

## add_idl()
Takes two arguments: the name of the target project and idl file.
```cmake
Expand Down