8 Replies - 394 Views - Last Post: 18 September 2019 - 07:41 AM Rate Topic: -----

#1 Xrey274   User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 294
  • Joined: 10-December 16

CMake generates shared library insteam of executable?

Posted 15 September 2019 - 12:58 PM

Title is pretty descriptive. Problem has a just started happening, haven't made major changes to the CMakeLists file.

Edit: I am using Linux if that matters(Manjaro Budgie).

CMakeLists.txt
cmake_minimum_required(VERSION 3.1)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

project(Splash)

set(SFML_DIR "/usr/lib/cmake/SFML")

find_package(SFML 2.5 COMPONENTS graphics system window REQUIRED)

add_executable(
    Splash
    main.cpp
    src/Resources.cpp
    src/EventHandle.cpp
    src/RenderEngine.cpp
    src/Canvas.cpp
    src/Brushes.cpp
    src/Circle.cpp
    src/Font.cpp
    src/FreeDraw.cpp
    src/Tabs.cpp
    
    include/Resources.h
    include/EventHandle.h
    include/RenderEngine.h
    include/Canvas.h
    include/Brushes.h
    include/Circle.h
    include/Font.h
    include/FreeDraw.h
    include/Tabs.h
)

target_link_libraries(Splash sfml-graphics sfml-system sfml-window)



This post has been edited by Xrey274: 15 September 2019 - 12:59 PM


Is This A Good Question/Topic? 0
  • +

Replies To: CMake generates shared library insteam of executable?

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7056
  • View blog
  • Posts: 23,996
  • Joined: 05-May 12

Re: CMake generates shared library insteam of executable?

Posted 15 September 2019 - 02:52 PM

Time to make full use of your source control. Do a diff against the version the builds properly and see what changed. (You did mention in your other threads that you are using a source control system, so finding the diffs should be easy.)
Was This Post Helpful? 2
  • +
  • -

#3 Xrey274   User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 294
  • Joined: 10-December 16

Re: CMake generates shared library insteam of executable?

Posted 16 September 2019 - 04:30 AM

The only thing that I have changed is that I added relative include paths(using ../include for ex.).
Was This Post Helpful? 0
  • +
  • -

#4 unixplumber   User is offline

  • New D.I.C Head

Reputation: 9
  • View blog
  • Posts: 12
  • Joined: 02-January 19

Re: CMake generates shared library insteam of executable?

Posted 16 September 2019 - 01:39 PM

As an aside (and I'm not familiar with CMake specifically), but are these header files supposed to be added to the executables list?

    include/Resources.h
    include/EventHandle.h
    include/RenderEngine.h
    include/Canvas.h
    include/Brushes.h
    include/Circle.h
    include/Font.h
    include/FreeDraw.h
    include/Tabs.h



Usually header files would not be in a list like this because they're not compiled on their own.
Was This Post Helpful? 1
  • +
  • -

#5 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7056
  • View blog
  • Posts: 23,996
  • Joined: 05-May 12

Re: CMake generates shared library insteam of executable?

Posted 16 September 2019 - 04:03 PM

+1.

And most build system worth their salt know how to do automatic dependency detection and maintenance. I've only skimmed the CMake documentation, but my understanding is that you just need to tell CMake where the include files are at using the target_include_directories() command.
Was This Post Helpful? 0
  • +
  • -

#6 Xrey274   User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 294
  • Joined: 10-December 16

Re: CMake generates shared library insteam of executable?

Posted 17 September 2019 - 07:24 AM

Is that related to why it's creating a shared library instead of a executable or just what I should be using in place of ".."?
Was This Post Helpful? 0
  • +
  • -

#7 Xrey274   User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 294
  • Joined: 10-December 16

Re: CMake generates shared library insteam of executable?

Posted 17 September 2019 - 07:35 AM

Also I did added target_add_directories and removed "..", but it's still generating a shared library file.
Was This Post Helpful? 0
  • +
  • -

#8 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7056
  • View blog
  • Posts: 23,996
  • Joined: 05-May 12

Re: CMake generates shared library insteam of executable?

Posted 17 September 2019 - 05:46 PM

Sorry, I'm not a CMake user and I've reached the limit of my knowledge. Personally, I use jam or make.
Was This Post Helpful? 0
  • +
  • -

#9 Xrey274   User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 294
  • Joined: 10-December 16

Re: CMake generates shared library insteam of executable?

Posted 18 September 2019 - 07:41 AM

I see, thank you. You my close this thread.

This post has been edited by Xrey274: 18 September 2019 - 07:41 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1