Skip to content

Commit

Permalink
change back to directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sannyschulz committed Jun 21, 2018
1 parent fdb3c57 commit 8265c8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion update_linux.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mkdir -p _cmake_linux
cd _cmake_linux
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cd ..

2 comments on commit 8265c8c

@sannyschulz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We develop on Windows and Linux. So this was never tested on MacOS.
Do you have something like an error log.

@bergm
Copy link
Member

@bergm bergm commented on 8265c8c Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We thought about this a bit and maybe it's because Clang doesn't simply use C++11 or higher. At least with GCC under Linux and VC++ under Windows everything works. Please try to add the following lines to the CMakeLists.txt in the util/tools/date folder:

target_compile_features(date_lib PUBLIC cxx_std_11)
set_target_properties(date_lib PROPERTIES CXX_EXTENSIONS OFF)

This is taken from https://cliutils.gitlab.io/modern-cmake/chapters/features/cpp11.html and maybe this helps to force C++11 for the compilation of date.h/date.cpp. The compiler errors don't make sense as it's telling all these

error: function definition does not declare
      parameters
                uint _d{0}, _m{0};

errors. But these symbols are there. The only thing somewhat "special" is the use of the default member initializers = {}, which according to https://en.cppreference.com/w/cpp/language/data_members#Member_initialization are there since C++11. I didn't, but should have, force CMake to compile the code with C++11 rules. So maybe Clang is more picky and tries to compile with C++03 until told otherwise.

project(Util-tools-date)

message(STATUS "-> Util-tools-date")

add_library(date_lib STATIC ../date.h ../date.cpp)
target_include_directories(date_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.. ../..)
target_compile_features(date_lib PUBLIC cxx_std_11)
set_target_properties(date_lib PROPERTIES CXX_EXTENSIONS OFF)
if(MSVC AND MT_RUNTIME_LIB)
	target_compile_options(date_lib PRIVATE "/MT$<$<CONFIG:Debug>:d>")
endif()

message(STATUS "<- Util-tools-date")

If it works that way, either you add it to all the CMakeLists.txt files or you tell me and I gonna do this. As if it doesn't work with date.h/cpp Clang should complain with the other files as well.

Please sign in to comment.