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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:28:33+00:00 2026-05-31T02:28:33+00:00

I am using CMake to build a project with external libraries by using Eclipse

  • 0

I am using CMake to build a project with external libraries by using “Eclipse CDT4 – Unix Makefiles”.

Importing in Eclipse leads to a working project, but only all header files and my implemented source files are recognized correctly by the index of Eclipse.
I would also like to navigate through the source files for one external library by using “ctrl+click”. I don’t know how to add the *.cpp files of that external library in my CMakeList.txt to get them recognized by the indexer without building the library.

  • 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-31T02:28:34+00:00Added an answer on May 31, 2026 at 2:28 am

    You can mark the .cpp files as “header file only” like this:

    # find all filenames in the lib path and gather them in $YOUR_LIB
    FILE(GLOB YOUR_LIB path_to_library/*.?pp)
    
    # create a seperate sourcegroup so it doesn't clutter up the rest of your code
    SOURCE_GROUP(\\lib FILES ${YOUR_LIB})
    
    # mark them as header-file only
    SET_SOURCE_FILES_PROPERTIES(${YOUR_LIB} PROPERTIES HEADER_FILE_ONLY TRUE)
    
    # add both your code and the lib-code to the project
    ADD_EXECUTABLE(program ${YOUR_CODE} ${YOUR_LIB})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built the OpenCV libraries using the cmake build system as described here
I have been using CMake with C++ to build libraries and executables and would
I'm using Apple, CMake 2.8.1 in order to build my project on Ubuntu 10.04:
I'm using CMake for my build system and in the project, we will have
I am using CMake to build my C++ project and it has multiple executables
In CMake, I'm trying to build a project that includes libraries for multiple different
I build my project with cmake in linux. I link some static libraries by
I am using CMake to build my project and I have the following line:
I have a project in Visual 2005 generated using CMake, and everytime I press
I am working on an open source project which uses C for libraries, C++

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.