When the linker goes to link the glfw library, it will start looking in all of the paths that are visible to it, starting with the first one specified (usually PATH environment variable, I believe) and continuing on to any paths specified using -L, in the order that they are specified. (Some paths may be specified by CodeBlocks internally, they'll probably translate to -L options on the command line and will probably be specified before any that you specify). As soon as it finds the first file matching the name it is looking for (ie, libglfw.a for a static library) then it will try to link that library in.
If the library it finds first was built for 64-bit, and your current project is 32-bit, it won't work. If your project is 64-bit and the first library it finds is 32-bit, again it won't work. You need to ensure that if you have both 32 and 64 bit versions of the library installed, that only one version (the correct one) is visible.
Also, there is a bit of confusion as far as 32-bit and 64-bit configuration. Just because your toolchain executables are all named mingw32-something, doesn't mean the project is necessarily configured for 32-bit. Usually, 64-bit is specified on the command line by a command line switch (-m64 for gcc) rather than by using files explicitly named mingw64-something. In CodeBlocks, I believe you have to manually add -m64 to the compiler options to enable 64-bit (unless in recent versions they have included a check-box switch for it. Alternatively, you can add your own check-box switch for it by right clicking on the Build options->Compiler settings pane and inputting the relevant flag).
Finally, if you are using CodeBlocks then there is really no need to use CMake. CodeBlocks will handle the Makefile behind the scenes so that you don't need to. It is possible to specify that a project use an externally generated Makefile (such as built by CMake) but in my opinion it complicates things, and if you are creating your own new project then it is unnecessary.