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

  • SEARCH
  • Home
  • 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 8593317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:57:39+00:00 2026-06-11T23:57:39+00:00

I have some huge project that is being compiled in CMake. It is developed

  • 0

I have some huge project that is being compiled in CMake.
It is developed for quite a long time, have 8000+ source/header files (over 500Mbytes, over 500 CMakefile.txt files).

They use directory structure like this

PROJECT_NAME
  src
    / subdir_name
    / other_dir_name
    / some_different_dir
    / MY_SPECIFIC_DIR             <---
    / yet_another_dir
   build

and build it out-source, like this:

name@host:~/PROJECT_NAME/build> cmake ../src
name@host:~/PROJECT_NAME/build> make all

then it’s build as one BIG binary (details are not important).


I cannot touch anything else, just content of MY_SPECIFIC_DIR – it’s source and CMake files.
So, I have source code in MY_SPECIFIC_DIR tweak CMakefile.txt files somehow and would like to build it like this:

name@host:~/PROJECT_NAME/build_specific> cmake ../src/MY_SPECIFIC_DIR
name@host:~/PROJECT_NAME/build_specific> make all

This should build things in MY_SPECIFIC_DIR into single binary with some few links to other subprojects. But also (obviously) don’t change anything about how whole project is compiled.

My question is:

Is my desired setup
posible
using CMake?
Can I somehow test in CMakeFile.txt that it is root project and build it in different way then when it is builded as a whole?


Unless, I have to resort to different means and use standard make for this.
I don’t know CMake so I’m hoping for YES/NO anwer, preferable even for technique how to achieve this. And then learn the CMake and do it.

Also, I must use CMake version 2.6.

Thanks

  • 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-11T23:57:40+00:00Added an answer on June 11, 2026 at 11:57 pm

    Basic concept is to use

    if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
       ... code for stand-alone app
    else()
       ... what was in this file before
    endif()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of the huge benefits in languages that have some sort of reflection/introspecition is
I have a huge file that has some lines that need to have a
I have a huge matrix that I divided it into some sub matrices and
I have a huge pl/sql stored procedure, where we make some deletions as long
I have this huge VB project which i just got from some one. i
Okay so I made some changes in my project that resulted in a huge
I have a huge multi-module project , which is being built using maven. Most
I have to give a general note to some huge Java project for which
We have a project that was implemented in linq to sql and is being
I have some HUGE log files (50Mb; ~500K lines) I need to start filtering

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.