Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to compile for release version in Cmake?  (Read 1158 times)

0 Members and 1 Guest are viewing this topic.

Dastan

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to compile for release version in Cmake?
« on: March 24, 2018, 09:16:45 pm »
This probably has a simple answer but I couldn't really find much.
I'm using CLion and have the following code in CMakeLists.txt:
Quote

cmake_minimum_required(VERSION 3.2)
project(CityBuildingGame)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -w -mwindows")

set(OUTPUT_DIR ${PROJECT_SOURCE_DIR}/bin)     # specify output directory

set(SOURCE_FILES main.cpp)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})   # set output directory
add_executable(CityBuildingGame ${SOURCE_FILES})

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
find_package(SFML REQUIRED system window graphics network audio)
if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(CityBuildingGame ${SFML_LIBRARIES})
endif()


But it seems that this only builds for the debug version since it throws an error when I delete one of the debug("-d") dll's. How do I specify it to build a release version?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How to compile for release version in Cmake?
« Reply #1 on: March 24, 2018, 11:47:08 pm »
You set the CMAKE_BUILD_TYPE to release.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Dastan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to compile for release version in Cmake?
« Reply #2 on: March 25, 2018, 05:03:41 am »
You set the CMAKE_BUILD_TYPE to release.

Ah. That worked. Thanks!