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 4321074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:42:11+00:00 2026-05-21T08:42:11+00:00

Here is what I want to do: Typing make all will build my library

  • 0

Here is what I want to do:

  • Typing make all will build my library and the docs for it.
  • Typing make test will build my lib (if necessary), gtest and then my tests
  • Typing make check runs make test if needed and then runs the executable

Right now I’ve only managed to get the first to work.
The problem I’m having is the conditional include of gtest.

Gtest uses CMake which is nice, in theory all I need to do is to include the gtest directory with add_subdirectory but then gtest will always be built.

My structure right now is:

CMakeLists.txt     (Here I add targets for doc and the library)
doc                (my doxygen docs)
include            (my headers)
lib                (where my compiled libraries go)
src                (where my .cpp files go)
test
    CMakeLists.txt (Here I add targets for gest and my tests)
    bin            (where the test executable will go)
    contrib        (where gtest is)
    src            (my tests)

I’m trying to figure out how to add gtest as a dependency to the test-target but not build gtest every time.

I’m really annoyed and the little to none information there is about learning CMake so if anyone know any in depth tutorials (available freely on the interwebs) that would be awesome.

  • 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-05-21T08:42:12+00:00Added an answer on May 21, 2026 at 8:42 am

    The trick is to do add_subdirectory(test EXCLUDE_FROM_ALL) and then none of the targets in that CMakeList.txt will added to the ALL target.

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

Sidebar

Related Questions

When I am building my typing tutor application the errors user made I want
Here I want to generate the designer file like default.aspx.designer.cs file for the page
Here i want to set theme for a master page but i don't know
I'm trying to make a bash script that will talk to a java program
This is for learning purposes. I wrote a script that will simulate typing. The
Here I want to show a second dialog box after first dialog box disappears.I
Am Newbie here.Am Beginner in php.I Create a sample Reg form.Here i want to
I want to prevent the user from entering more than 100 characters into a
I have a list of strings that are all early modern English words ending
I just want some confirmation. I'm developing on windows I'm attempting to integrate facebook

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.