Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting CMAKE_CXX_STANDARD leads to error #41

Open
chronoxor opened this issue Jun 25, 2019 · 1 comment
Open

Setting CMAKE_CXX_STANDARD leads to error #41

chronoxor opened this issue Jun 25, 2019 · 1 comment

Comments

@chronoxor
Copy link

Setting CMAKE_CXX_STANDARD leads to error

Minimal CMakeLists.txt example reproducing bug or showing requested feature:

cmake_minimum_required(VERSION 3.0)

# Choose C++ standard
set(CMAKE_CXX_STANDARD 17)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/CMakePCHCompiler)

project(pchtest CXX CXXPCH)

add_library(engine src/engine.cpp src/library.cpp)
target_precompiled_header(engine src/prefix.h)

add_executable(demo src/demo.cpp)
target_link_libraries(demo engine)
target_precompiled_header(demo src/prefix.h REUSE engine)

Leads to error:

CMake Error at /home/user/workspace/CMakePCHCompiler/CMakePCHCompiler.cmake:116 (add_library):
  CXXPCH_STANDARD is set to invalid value '17'
Call Stack (most recent call first):
  CMakeLists.txt:10 (target_precompiled_header)

Additional information

  • OS [Ubuntu]
  • CMake version [3.14.1]
  • Compiler type and version [GCC 7.2]
@m-7761
Copy link
Contributor

m-7761 commented Sep 12, 2019

There is code that deals with this in the module. I don't know if it neglects 17 exclusively or not off the top of my head. It may hardcode the version numbers. 17 may be newer than CMakePCHCompiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants