Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:16:04+00:00 2026-06-02T00:16:04+00:00

I have a C++ project with mostly native code (core libraries + WIndows service)

  • 0

I have a C++ project with mostly native code (core libraries + WIndows service) and a configuration GUI written in managed C++. I’ve ported most of this project to CMake, but I’m stuck with building the managed C++ code using CMake.

The top-level targets look like:

# Native C++ static libraries.
add_library(sql STATIC ...)
add_library(w32 STATIC ...)
add_library(smdr STATIC ...)

# Native C++ programs depending on above libraries.
add_executable(logging-service ...)
target_link_libraries(logging-service sql w32 smdr)
# ... more native executables here...

# Managed C++ GUI application (doesn't link with any of the above).
add_executable(configuration-editor ...)

I can’t find any relevant information in the CMake documentation, and most solutions I see in search results (e.g. messages in the mailing list) involve tweaking the CMAKE_CXX_FLAGS* variables. However, this creates conflicts the other C++ projects.

How would you set up the build scripts to have two sets of C++ compiler flags, one for native libraries and one for managed applications?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:16:06+00:00Added an answer on June 2, 2026 at 12:16 am

    After reading of various posts in the CMake mailing lists, it seems that the CMAKE_CXX_FLAGS* variables are local to each CMakeLists.txt and inherited by child directories using add_subdirectory().

    So apparently, the recommended way to have multiple sets of compiler flags is to make sibling sub-directories that each set their own compiler flags. I just added two folders native and managed and each sets their own compiler flags in their respective CMakeLists.txt. Now, everthing builds as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have project written in Zend Framework and it works fine most of environments.
I'm about to walk into a project that will have files (mostly PHP) behind
I have a project that uses two third party libraries, both of which make
We have a large VS 2010 solution that is mostly C# code but there
I have a project which will be made up mostly of Java Servlets, JSP/Html
I've inherited a project written mostly in VB. I'd like to maintain what I
I've inherited a project written mostly in VB. I'd like to maintain what I
I'm currently using jenkins/hudson for continuous integration a large mostly C++ project. We have
I'm building a tool in managed code (mostly C++/CLI) in two versions, a 'normal
So I have a Git project, and we (a mostly typical Rails project) have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.