Skip to content

Global compile options are missing #21

@SpriteOvO

Description

@SpriteOvO

Simplified example:

top-level CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(FindWDK_IssueTest)

add_compile_options("/MP")

add_subdirectory(Exe)
add_subdirectory(Sys)

Exe CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(FindWDK_IssueTest_Exe)

add_executable(FindWDK_IssueTest_Exe Main.cpp)

Sys CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(FindWDK_IssueTest_Sys)

find_package(WDK REQUIRED)

wdk_add_driver(FindWDK_IssueTest_Sys Main.cpp)

So, I added a compile option /MP to the top-level CMakeLists.txt and want it to work on all subdirectories.
But when I open the generated solution, I see that the compile option only applies to the project Exe and not both.
image
image

Of course, there is a workaround:

top-level CMakeLists.txt:

set(MY_GLOBAL_COMPILE_OPTIONS "/MP")
add_compile_options(${MY_GLOBAL_COMPILE_OPTIONS})

Sys CMakeLists.txt:

wdk_add_driver(FindWDK_IssueTest_Sys Main.cpp)
target_compile_options(FindWDK_IssueTest_Sys PRIVATE ${MY_GLOBAL_COMPILE_OPTIONS})

It works, but obviously not so elegantly.

I personally think this is a bug. So, I was wondering if it is possible for FindWDK to keep global compile options that are safe for driver projects?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions