1
\$\begingroup\$

Can someone give me a simple step-by-step on how to set up and compile a simple "Hello World!" program on CLion using OpenGl/SDL/Freeglut . I see a lot of tutorials on Visual Studio, but CLion uses CMake so it's a lot different.

\$\endgroup\$

closed as off-topic by Kromster, Alexandre Vaillancourt, Almo, Seth Battin, DMGregory Sep 17 '16 at 16:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Kromster, Alexandre Vaillancourt, Almo, Seth Battin
If this question can be reworded to fit the rules in the help center, please edit the question.

3
\$\begingroup\$

Use a CMakeLists.txt file. It would look something like this.

cmake_minimum_required(VERSION 3.3)
project(projectname)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -fpermissive")

find_package (PkgConfig REQUIRED)
find_package (OpenGL REQUIRED)
find_package (GLUT REQUIRED)


include_directories(${OPENGL_INCLUDE_DIR}  ${GLUT_INCLUDE_DIRS})

file(GLOB SOURCE_FILES
    *.cpp
    *.h
    )

add_executable(main.cpp ${SOURCE_FILES})

target_link_libraries (main.cpp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} GL m dl Xinerama Xrandr Xi Xcursor X11 Xxf86vm pthread)

I copied this from a test project that I have. It works on Linux and Windows both. It is stripped down to only what is necessary.

This is where I learned https://cmake.org/cmake-tutorial/

\$\endgroup\$
  • \$\begingroup\$ Are OPENGL_INCLUDE_DIR and GLUT_INCLUDE_DIRS automatically set, or are they placeholders for the actual include directories? \$\endgroup\$ – Nic Hartley Mar 8 '18 at 5:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.