CMake with CodeLite, a general question
- caibbor
- CodeLite Veteran
- Posts: 78
- Joined: Thu Jan 10, 2013 10:37 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
CMake with CodeLite, a general question
I used cmake once a long time ago but couldn't quite figure out how to get it to acknowledge certain dependencies of my project. I ended up scrapping cmake. I'm curious now about CodeLite's cmake features. Since I already have my entire project set up and compiling in CodeLite, I thought that if I enabled cmake for the project that it would automatically geerate all the CMakeLists.txt files when I made a change to the project. It seems however that I have t manually make these files, that CodeLite will not generate them for me.
If that is the case, if I set up and enable cmake with my CodeLite project, will CodeLite ignore all the compiler/linker/etc options I've set up in the IDE?
If I add a file to a CMakeLists.txt, I then also manually have to add that to my CodeLite project?
Am I misunderstanding or is there a lot of manual synchronization I have to do between cmake and my CL project?
If that is the case, if I set up and enable cmake with my CodeLite project, will CodeLite ignore all the compiler/linker/etc options I've set up in the IDE?
If I add a file to a CMakeLists.txt, I then also manually have to add that to my CodeLite project?
Am I misunderstanding or is there a lot of manual synchronization I have to do between cmake and my CL project?
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: CMake with CodeLite, a general question
You should have the CMake plugin enabled by default.
This will automatically create CMakeLIsts.txt for you that will "export" all of your codelite settings into CMakeLists.txt
Next, 'enable' cmake in the project settings (right click on the project -> Settings -> CMake)
Eran
Right click on the project and select CMake -> Export CMakeLists.txtcaibbor wrote:It seems however that I have t manually make these files, that CodeLite will not generate them for me
This will automatically create CMakeLIsts.txt for you that will "export" all of your codelite settings into CMakeLists.txt
Next, 'enable' cmake in the project settings (right click on the project -> Settings -> CMake)
Eran
Make sure you have read the HOW TO POST thread
- caibbor
- CodeLite Veteran
- Posts: 78
- Joined: Thu Jan 10, 2013 10:37 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: CMake with CodeLite, a general question
Oh nice, I never noticed that menu before.
Compiling with cmake from the commandline: I generated a CMakeLists.txt file, created a sub-directoy called "build-debug", did the whole `cmake ..` thing which worked fine, but make throws errors about my use of C++11 features. I've verified that the CMakeLists.txt contains -std=c++11 in both CMAKE_CXXFLAGS and CMAKE_LDFLAGS
my CMakeLists.txt
Note: I keep project files in a different directory, such as:
trunk/codelite/project.project
trunk/codeblocks/project.cbp
trunk/src/allMySouces.cpp
output of `cmake ..`
First few lines of output of `make`
Compiling with cmake from the commandline: I generated a CMakeLists.txt file, created a sub-directoy called "build-debug", did the whole `cmake ..` thing which worked fine, but make throws errors about my use of C++11 features. I've verified that the CMakeLists.txt contains -std=c++11 in both CMAKE_CXXFLAGS and CMAKE_LDFLAGS
my CMakeLists.txt
Code: Select all
cmake_minimum_required(VERSION 2.6.2)
project(clib)
include_directories(
.
.
/home/brandon/.x/btech3/include/clib/codelite/
/home/brandon/.x/btech3/include/clib/codelite/
)
add_definitions(
-D__linux=1
-DCLIB_DEBUG=1
-DCLIB_UNIT_TEST=1
-DBTECH_COMPILER_GNU=1
-DCLIB_UNIT_TEST=1
)
set(CMAKE_CXXFLAGS "${CMAKE_CXXFLAGS} -Wmain -g -ansi -Wall -Wextra -Weffc++ -Wswitch-default -Wmissing-include-dirs -Wswitch-enum -Wmissing-declarations -Wunreachable-code -Winline -Wfloat-equal -Wundef -Wcast-align -Wredundant-decls -Winit-self -Wnon-virtual-dtor -Wshadow -Wvla -Wunsafe-loop-optimizations -Wtype-limits -Wtrampolines -Wstrict-overflow=5 -Wstrict-overflow -Wsign-conversion -Wpointer-arith -Wpacked -Woverloaded-virtual -Wold-style-cast -Wmissing-format-attribute -Wmissing-field-initializers -Wlogical-op -Winvalid-pch -Wignored-qualifiers -Wformat-nonliteral -Wformat=2 -Wempty-body -Wdouble-promotion -Wdisabled-optimization -Wctor-dtor-privacy -Wconversion-null -Wconversion -Wclobbered -Wcast-qual -Wabi -Wpadded -ggdb -Waddress -Warray-bounds -Wc++0x-compat -Wchar-subscripts -Wcomment -Wcoverage-mismatch -Wenum-compare -Wformat -Wformat-security -Wmissing-braces -Wnoexcept -Woverlength-strings -Wpacked-bitfield-compat -Wparentheses -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare -Wsign-promo -Wstack-protector -Wstrict-aliasing -Wstrict-null-sentinel -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wswitch -Wsync-nand -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -fno-exceptions -finline-functions-called-once -finline-small-functions -finline-functions -m32 -std=c++11 -fno-exceptions")
# Linker options
set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -ggdb -m32 -std=c++11 -fno-exceptions")
# Library path
set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} ")
set(SRCS
../src/files/filesystem.cpp
../src/files/filesystem.h
../src/files/tga.cpp
../src/files/tga.h
../src/files/zip.cpp
../src/files/zip.h
../src/files/base/file.cpp
../src/files/base/file.h
../src/files/base/image.cpp
../src/files/base/image.h
../src/files/parsers/binary.cpp
../src/files/parsers/binary.h
../src/files/parsers/ssv.cpp
../src/files/parsers/ssv.h
../src/files/parsers/text.cpp
../src/files/parsers/text.h
../src/files/archived.cpp
../src/files/archived.h
../src/containers/dict.cpp
../src/containers/dict.h
../src/containers/hashlist.h
../src/containers/linklist.h
../src/containers/keyvalpair.h
../src/containers/color.cpp
../src/containers/color.h
../src/containers/hashedLinklist.h
../src/containers/hashlist.cpp
../src/containers/linklist.cpp
../src/math/circle.cpp
../src/math/circle.h
../src/math/ellipse.cpp
../src/math/ellipse.h
../src/math/mat3.cpp
../src/math/mat4.cpp
../src/math/plane.cpp
../src/math/plane.h
../src/math/values.h
../src/math/vec2t.h
../src/math/vec2t-dec.h
../src/math/vec3t.h
../src/math/vec3t-dec.h
../src/math/mat.h
../src/math/quat.cpp
../src/math/quat.h
../src/math/line.cpp
../src/math/line.h
../src/math/vec2t.cpp
../src/math/vec3t.cpp
../src/math/aabox3d.cpp
../src/math/aabox3d.h
../src/math/box3d.cpp
../src/math/box3d.h
../src/math/dualquat.cpp
../src/math/dualquat.h
../src/math/values.cpp
../src/math/cone.cpp
../src/math/cone.h
../src/math/poly3d.cpp
../src/math/poly3d.h
../src/math/capsule.cpp
../src/math/capsule.h
../src/math/cylinder.cpp
../src/math/cylinder.h
../src/math/sphere.cpp
../src/math/sphere.h
../src/args.h
../src/clib.h
../src/hash.h
../src/macros.h
../src/maths.h
../src/random.h
../src/strings.h
../src/types.h
../src/args.cpp
../src/hash.cpp
../src/macros.cpp
../src/maths.cpp
../src/random.cpp
../src/strings.cpp
../src/types.cpp
../src/search/search.cpp
../src/search/search.h
../src/sort/sort.cpp
../src/sort/sort.h
../src/bitwise.h
../src/unit_test.cpp
../src/unit_test.h
../src/cpuid.cpp
../src/cpuid.h
../src/fillArray.cpp
../src/fillArray.h
../src/message.cpp
../src/message.h
../src/unicode.cpp
../src/unicode.h
../src/global.h
../src/std.h
)
add_library(clib ${SRCS})
trunk/codelite/project.project
trunk/codeblocks/project.cbp
trunk/src/allMySouces.cpp
output of `cmake ..`
Code: Select all
cmake ..
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brandon/.x/btech3/include/clib/codelite/build-debug
Code: Select all
Scanning dependencies of target clib
[ 2%] Building CXX object CMakeFiles/clib.dir/home/brandon/.x/btech3/include/clib/src/files/filesystem.cpp.o
In file included from /usr/include/c++/4.8/cstdint:35:0,
from /home/brandon/.x/btech3/include/clib/src/files/./.././types.h:7,
from /home/brandon/.x/btech3/include/clib/src/files/./../global.h:6,
from /home/brandon/.x/btech3/include/clib/src/files/./filesystem.h:12,
from /home/brandon/.x/btech3/include/clib/src/files/filesystem.cpp:6:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from /home/brandon/.x/btech3/include/clib/src/files/./../global.h:6:0,
from /home/brandon/.x/btech3/include/clib/src/files/./filesystem.h:12,
from /home/brandon/.x/btech3/include/clib/src/files/filesystem.cpp:6:
/home/brandon/.x/btech3/include/clib/src/files/./.././types.h:52:9: error: ‘int8_t’ in namespace ‘std’ does not name a type
typedef std::int8_t int8;
^
/home/brandon/.x/btech3/include/clib/src/files/./.././types.h:53:9: error: ‘uint8_t’ in namespace ‘std’ does not name a type
typedef std::uint8_t Uint8;
^
/home/brandon/.x/btech3/include/clib/src/files/./.././types.h:54:9: error: ‘int16_t’ in namespace ‘std’ does not name a type
typedef std::int16_t int16;
^
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: CMake with CodeLite, a general question
Try and run the generated Makefile (the one generated by the CMakeLists.txt that was produced by the CMake plugin) from the command line like this:
This will show what flags are actually passed to the compiler (from the CMakeLists.txt I see that you are passing -std=c++11)
Eran
Code: Select all
make VERBOSE=1
Eran
Make sure you have read the HOW TO POST thread
- caibbor
- CodeLite Veteran
- Posts: 78
- Joined: Thu Jan 10, 2013 10:37 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: CMake with CodeLite, a general question
the -std=c++11 flag doesn't seem to be anywhere in the output. in fact, it seems like none of them are being used.
first few lines of `make VERBOSE=1`
first few lines of `make VERBOSE=1`
Code: Select all
/usr/bin/cmake -H/home/caibbor/proj/btech3/include/clib/codelite -B/home/caibbor/proj/btech3/include/clib/codelite/build-debug --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles /home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/caibbor/proj/btech3/include/clib/codelite/build-debug'
make -f CMakeFiles/clib.dir/build.make CMakeFiles/clib.dir/depend
make[2]: Entering directory `/home/caibbor/proj/btech3/include/clib/codelite/build-debug'
cd /home/caibbor/proj/btech3/include/clib/codelite/build-debug && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/caibbor/proj/btech3/include/clib/codelite /home/caibbor/proj/btech3/include/clib/codelite /home/caibbor/proj/btech3/include/clib/codelite/build-debug /home/caibbor/proj/btech3/include/clib/codelite/build-debug /home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles/clib.dir/DependInfo.cmake --color=
Dependee "/home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles/clib.dir/DependInfo.cmake" is newer than depender "/home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles/clib.dir/depend.internal".
Dependee "/home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles/clib.dir/depend.internal".
Scanning dependencies of target clib
make[2]: Leaving directory `/home/caibbor/proj/btech3/include/clib/codelite/build-debug'
make -f CMakeFiles/clib.dir/build.make CMakeFiles/clib.dir/build
make[2]: Entering directory `/home/caibbor/proj/btech3/include/clib/codelite/build-debug'
/usr/bin/cmake -E cmake_progress_report /home/caibbor/proj/btech3/include/clib/codelite/build-debug/CMakeFiles 1
[ 2%] Building CXX object CMakeFiles/clib.dir/home/caibbor/proj/btech3/include/clib/src/files/filesystem.cpp.o
/usr/bin/c++ -DBTECH_COMPILER_GNU=1 -DCLIB_DEBUG=1 -DCLIB_UNIT_TEST=1 -D__linux=1 -I/home/caibbor/proj/btech3/include/clib/codelite/. -I/home/brandon/.x/btech3/include/clib/codelite -o CMakeFiles/clib.dir/home/caibbor/proj/btech3/include/clib/src/files/filesystem.cpp.o -c /home/caibbor/proj/btech3/include/clib/src/files/filesystem.cpp
In file included from /usr/include/c++/4.8/cstdint:35:0,
from /home/caibbor/proj/btech3/include/clib/src/files/./.././types.h:7,
from /home/caibbor/proj/btech3/include/clib/src/files/./../global.h:6,
from /home/caibbor/proj/btech3/include/clib/src/files/./filesystem.h:12,
from /home/caibbor/proj/btech3/include/clib/src/files/filesystem.cpp:6:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from /home/caibbor/proj/btech3/include/clib/src/files/./../global.h:6:0,
from /home/caibbor/proj/btech3/include/clib/src/files/./filesystem.h:12,
from /home/caibbor/proj/btech3/include/clib/src/files/filesystem.cpp:6:
/home/caibbor/proj/btech3/include/clib/src/files/./.././types.h:52:9: error: ‘int8_t’ in namespace ‘std’ does not name a type
typedef std::int8_t int8; ^
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: CMake with CodeLite, a general question
Try removing the build-debug/CMakeCache.txt and re-compile the project. Maybe something with CMake's cache ...
I will see if there are other ways to pass the flags
Eran
I will see if there are other ways to pass the flags
Eran
Make sure you have read the HOW TO POST thread
- caibbor
- CodeLite Veteran
- Posts: 78
- Joined: Thu Jan 10, 2013 10:37 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: CMake with CodeLite, a general question
did a `rm -rf` on the build-debug dir, deleted the CMakeLists.txt and regenerated via CodeLite, made a new dir, did the cmake .. etc etc, same problem.
I am using cmake version 2.8.11.2
I am using cmake version 2.8.11.2
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: CMake with CodeLite, a general question
Try with latest git head. It should be fixed - I did a lot of improvements to the CMake plugin during the weekend
Eran
Eran
Make sure you have read the HOW TO POST thread