rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.17k stars 439 forks source link

CMake Error: unknown command "generateLibraryVersionVariables" #262

Closed willowell closed 4 years ago

willowell commented 4 years ago

OS: macOS 10.15.1 RTTR version: 0.9.6 Doxygen version: 1.8.17, installed through Homebrew Boost version: 1.72.0, installed through Homebrew

Hello! I found RTTR through an article about building a runtime reflection system for C++. I followed the instructions here https://www.rttr.org/doc/master/building_install_page.html, but CMake failed to build RTTR because it cannot find generateLibraryVersionVariables, even though that does exist at line 517 in rttr-0.9.6-src/CMake/utility.cmake

I have assumed <path to RTTR src code> is rttr-0.9.6-src/src and that I can pass CMake -G "Unix Makefiles" for use with JetBrains CLion.

Here are the steps I took:

  1. Download rttr-0.9.6-src.zip
  2. Unzip and cd into the folder
  3. Run cmake -G "Unix Makefiles" ./src

CMake Output is

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Scanning rttr module.
-- ===========================
CMake Error at rttr/CMakeLists.txt:33 (generateLibraryVersionVariables):
  Unknown CMake command "generateLibraryVersionVariables".

CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.16)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/Users/User/path/to/rttr-0.9.6-src/CMakeFiles/CMakeOutput.log".

I'm new to CMake, so I don't know if this is a problem on my end or on RTTR's end. I hope I have just called CMake incorrectly 😅

Thank you for reading!

dushyant-shukla commented 4 years ago

I just did cmake . inside the root. It worked.

willowell commented 4 years ago

Wow. I just tried that, and it worked for me, too. Thanks @dushyant-shukla! Guess I was just overthinking it.

KeyC0de commented 3 years ago

I got the same error. I am on Windows 8.1, amd64, Visual Studio 2017. I tried cmake . inside the root folder to no avail.

Error log:

C:\Users\username\Documents\github\rttr-master>cmake -G "Visual Studio 15 2017" C:\
Users\username\Documents\github\rttr-master\src\
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 6.3.9600.
-- The C compiler identification is MSVC 19.16.27035.0
-- The CXX compiler identification is MSVC 19.16.27035.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/
2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/
2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi
o/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi
o/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Scanning rttr module.
-- ===========================
CMake Error at rttr/CMakeLists.txt:33 (generateLibraryVersionVariables):
  Unknown CMake command "generateLibraryVersionVariables".

CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.12)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

I've been following instructions from here: https://www.rttr.org/doc/master/building_install_page.html

Any help would be appreciated.