Skip to content

Fix installed CMake SDK dependency propagation - #9

Open
eronnen wants to merge 1 commit into
19h:masterfrom
eronnen:fix-cmake-interface-2
Open

Fix installed CMake SDK dependency propagation#9
eronnen wants to merge 1 commit into
19h:masterfrom
eronnen:fix-cmake-interface-2

Conversation

@eronnen

@eronnen eronnen commented Aug 5, 2026

Copy link
Copy Markdown

The installed idax::idax target references the build-only idasdk_headers target, which does not exist downstream. As a result, find_package(idax REQUIRED) produces an unusable target unless consumers recreate an internal IDAX detail.

Recreate the dependency as idax::sdk_headers from IDA SDK 9.4 before loading idaxTargets.cmake. Normalize documented IDASDK layouts and preserve the effective MSVC runtime across SDK discovery.

Host-specific SDK target selection remains consumer-owned. This changes no C++ API or ABI.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d20f51d5c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread cmake/idaxConfig.cmake.in Outdated
The installed idax::idax target references the build-only idasdk_headers target, which does not exist downstream. As a result, find_package(idax REQUIRED) produces an unusable target unless consumers recreate an internal IDAX detail.

Recreate the dependency as idax::sdk_headers from IDA SDK 9.4 before loading idaxTargets.cmake. Normalize documented IDASDK layouts and preserve the effective MSVC runtime across SDK discovery.

Host-specific SDK target selection remains consumer-owned. This changes no C++ API or ABI.
@eronnen
eronnen force-pushed the fix-cmake-interface-2 branch from 4d20f51 to a493efe Compare August 5, 2026 19:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a493efeaef

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread cmake/idaxConfig.cmake.in
endif()
endif()

find_dependency(idasdk 9.4 EXACT CONFIG)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Set IDA_USE_STATIC_RUNTIME before loading the SDK

When a Windows consumer has no explicit CRT setting, _idax_msvc_runtime becomes idax's default /MT, but this call loads the IDA SDK while IDA_USE_STATIC_RUNTIME is still the SDK default OFF; the exact 9.4 config creates idasdk::* against the non-_s Windows libraries before line 42 restores /MT. A normal find_package(idax); ida_add_plugin(... LIBRARIES idax::idax) therefore compiles the plugin with the static CRT while linking the DLL-CRT SDK import libraries, producing MSVC runtime mismatch diagnostics. Set/derive IDA_USE_STATIC_RUNTIME before this dependency load when applying idax's static runtime. Fresh evidence beyond the earlier CRT comment is that SDK target selection now happens inside this new find_dependency call before the runtime restore.

Useful? React with 👍 / 👎.

19h commented Aug 5, 2026

Copy link
Copy Markdown
Owner

This review was authored by GPT-5.6 Sol.

I’m requesting changes because the installed-package repair still has three compatibility problems:

  1. On Windows, find_dependency(idasdk ...) runs before IDAX restores its /MT runtime. IDA SDK 9.4 uses IDA_USE_STATIC_RUNTIME during discovery to select both the CRT and the _s library variant. Restoring CMAKE_MSVC_RUNTIME_LIBRARY afterward is too late, leaving consumers compiled with /MT against SDK targets selected for /MD. Please derive or validate IDA_USE_STATIC_RUNTIME before loading the dependency.

  2. Installed discovery only probes cmake/ and src/cmake/, while the source build and repository knowledge base explicitly support ida-cmake/ and src/ida-cmake/ bootstrap layouts. I reproduced a 9.4 header tree that builds successfully from source but fails through installed find_package(idax). Even an explicit idasdk_DIR fails because 9.4 EXACT rejects the maintained bootstrap package’s 9.2.0 metadata despite pro.h reporting SDK 940. The installed resolver should mirror the source resolver and validate the actual SDK header version.

  3. The reconstructed idax::sdk_headers target links the unfiltered ida_compiler_settings. Source builds deliberately remove -flto under D-19.11/F313, but an installed Release consumer again receives -flto with the maintained ida-cmake interface. That recreates the documented static-archive and downstream Rust-linking failure. Please apply the same sanitization after dependency discovery.

The primary export repair works for the current in-tree SDK layout: Release build/install succeeds, and downstream consumers compile using SDK-root and checkout-root paths supplied through either the environment or CMake. However, the remaining issues are merge-blocking, and the .agents closure records should be corrected after they are resolved. Persistent installed-package tests should cover Windows CRT/library selection, every supported SDK layout, and absence of propagated LTO.

@eronnen

eronnen commented Aug 5, 2026

Copy link
Copy Markdown
Author

Thanks for the PR review @19h, but I tried a few times and I think it will be difficult for me to land a good patch to fix the issue since I have only Mac setup and no MSVC.

I added a simple but sufficient description of the issue in #10, any chance you can take a look and possibly fix with your agent?

@19h

19h commented Aug 5, 2026

Copy link
Copy Markdown
Owner

I’ll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants