We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3269 - CMake 3.5 could not build SDL source
Summary: CMake 3.5 could not build SDL source
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: don't know
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-23 22:09 UTC by gfan
Modified: 2016-02-23 22:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gfan 2016-02-23 22:09:45 UTC
in CMakeLists.txt, we have :

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
endif()

in CMake version 3.5-RCx, CMAKE_BINARY_DIR is internally setting ( looks like  ) to be the same as CMAKE_SOURCE_DIR. So the above comparison will end up with always TRUE, hence could not build.  This happens with all version of CMAKE 3.5 RC.  CMake guys recommended not to manually mess up CMAKE_BINAR_DIR, so they have no plan to make it behaves the same as earlier cmake versions.

With some experiments, looks this could be fixed with

if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
  message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
endif()

CMAKE_CURRENT_SOURCE_DIR & CMAKE_CURRENT_BINARY_DIR approach works for both cmake 3.5 RC versions and also 3.4, 3.3