PDA

View Full Version : How identify the Operational System in project file (.pro)



njrizzo
19th August 2015, 03:40
I need reconize the operation system when I will run (build) the project
because I'm using Linux in my work and the FreeBSD in my house
and I have change a include and lib dirs all times. I would not use
a
LIBS += -L/usr/local/lib
LIBS += -L/usr/lib

and

INCLUDE += -I/usr/local/include
INCLUDE += -I/usr/include

I would like use some think like

FreeBSD : {

}

Linux: {
}

Someone have an idea?

prasad_N
19th August 2015, 07:15
http://www.qtcentre.org/threads/14675-pro-project-file-includes-quot-unix-quot-with-quot-macx-quot-defintions-with-qmake

canbe like ths:


win32 {
SOURCES += ........
}
!win32 {
SOURCES += ......
}

ChrisW67
19th August 2015, 11:46
Something like:


freebsd-g++: {
message("FreeBSD stuff in here")
}
linux-g++: {
message("Linux stuff in here")
}

might get you there.

It's quite possible that most (or all) of the LIBS and INCLUDEPATHs you used as an example are in the compiler defaults on both platforms, i.e. they do not need to be specified. On my Linux box the INCLUDEPATH would be covered by defaults, but /usr/local/lib would need to be in LIBS.

njrizzo
20th August 2015, 00:50
ChrisW67. I use only this for example, the real code is more
complex and need identify the compiler and system correctly

Thankx alot

the finish solution is:

freebsd-clang: { // To my home box running FreeBSD 11 (aka -current) and clang compiler

}

freebsd-g++: { //if I will use a gcc (g++) I 'll use

}

Thankx