Date:09.03.2017, 04:34 Things get tricky when the right side of the STREQUAL is a string that matches the name of a variable: set(var "stuff set(stuff ON) if(var STREQUAL "stuff message var STREQUAL stuff else message NOT var STREQUAL stuff endif According to the. ENDIF (WIN32) Check operating system IF(CMAKE _SYSTEM _NAME STREQUAL Linux) Check if environment variable is set. Test if an environment variable is defined, bail out if it is not. Normally, operating system environment variables are referenced with syntax like ENVFOO _HOME. Txt file, you can tell CMake to try to use them first before looking at system paths by doing: set(CMAKE _MODULE _PATH "CMAKE _SOURCE _DIR CMAKE _MODULE _PATH ) Checking if a package was found Most of the time the PackageName_FOUND. Txt use: FIND _PACKAGE (ITK REQUIRED ) INCLUDE (ITK_USE_FILE ) ADD_EXECUTABLE (CastImageFilter x) TARGET _LINK _LIBRARIES (CastImageFilter vtkHybrid ITKIO ITKB asicFilters ITKC ommon ) VXL Add the path to your environment: export VXLBIN home/doriad/bin/vxl" Then in the CMakeLists. Are you assuming that var would be converted to bool, and the string "stuff" to the contents of the variable "stuff"? I don't think that's how it's supposed to work. To access the contents of a variable, you need to enclose.